Sorted Dictionary Collection - Compare Event

Compare is triggered when two key components need to be compared

Member of Sorted Dictionary Collection (PRIM_SDCO)

Parameters

Name

Type

Data Type

Description

Object

*Input

PRIM_OBJT

Object is the component being compared to

Subject

*Input

PRIM_OBJT

Subject is the component being compared

Result

*Both

Enumeration

Result 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

  • No labels