Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Using Block Evaluate to Sort an Array of Objects

  • Last UpdatedNov 10, 2025
  • 1 minute read

There are no built-in array methods yet for sorting an array of objects. A possible technique is to use a block evaluation to create an array of keys to sort:

 - - Create a block to extract the object member on which to sort

!ExtractKeys = object BLOCK ('!MyEmployees[!Evalindex].Name')

 - - Evaluate the block to generate an array of sort keys

!SortKeys = !MyEmployees.Evaluate(!ExtractKeys)

 - - Create a new array containing the sorted element positions

!NewOrder = !SortKeys.SortedIndices()

 - - Apply the sorted element positions to the original array

!MyEmployees.ReIndex(!NewOrder)

This Evaluate method is the equivalent of the older command:

VAR .. EVALUATE .. INDICES ARRAY

Note: In particular that there is no automatic database navigation.

Related Links
TitleResults for “How to create a CRG?”Also Available in