Carousel Design Interface - OnSort Method

Executed when the Sort method is invoked on the parent list

Member of Carousel Design Interface (PRIM_CARO.ICarouselDesign)


NameTypeData TypeDescription
Result*ResultEnumerationResult of comparing the two values - Less, Equal or Greater
CarouselItem*InputPRIM_CARO.CarouselItemReference to the Item
CompareTo*InputPRIM_CARO.CarouselItemReference to the list item to be compared to
Key*InputPRIM_VARType of sort required


The OnItemSort method is executed whenever the item is referred to in the sort running on the containing Carousel.
Sorting is entirely user defined and it is therefore necessary to supply the Key (the 'value' that is being sorted) and the Order to the sort routine. This information is then used in the OnSort method.


Redefine the method in the design reusable part.
This example supports 3 different sorts: EMPNO, SURNAME and GIVENAME. These Key values are entirely arbitrary, but for simplicity they match with specific field names. The sorting here is only ever Ascending.
In each case, the local variable value is compared to the equivalent variable value, in this case published as a property of the design instance, to determine whether each value is less then, equal to, or greater than the other.
The OnSort method may be called many times for each item as the sort process evaluates each of the items.
Mthroutine Name(OnSort) Options(*Redefine)
   Case (#Key)
   When (= EMPNO)
      #Result := #Empno.Compare( (#CompareTo.Design *As #EmployeePart).Empno )
   When (= GIVENAME)
      #Result := #Givename.Compare( (#CompareTo.Design *As #EmployeePart).Givename )
   When (= SURNAME)
      #Result := #Surname.Compare( (#CompareTo.Design *As #EmployeePart).Surname )

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2