Sorted Array Collection - Compare Event

Compare is triggered when two key components need to be compared

Member of Sorted Array Collection (PRIM_SACO)

Parameters

NameTypeData TypeDescription
Object*InputPRIM_OBJTObject is the component being compared to
Subject*InputPRIM_OBJTSubject is the component being compared
Result*BothEnumerationResult is the result of the comparison

Details

The Compare event is fired whenever the collection needs to compare two components to determine their relative position.
 
The Subject and Object parameters contain the two instances to assess.  A result of Greater, Less or Equal must be returned.
 
If the event is not coded, the collection will compare the two. This effectively uses the memory address of the two collection items.

Example

This example shows the comparison of two customer objects using the Surname property to define the sort order.
 
This example uses the Compare intrinsic to simplify the code.
Evtroutine Handling(#Customers.Compare) Subject(#Subject) Object(#Object) Result(#Result)
 
   #Result := #Subject.Surname.Compare(#Object.Surname)
 
Endroutine

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2