🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators orderBy

Sorts the collection on one or more properties.

See also: orderDescending

NOTE: Earlier OCLPs only allowed ordering attributes on the class of the collection, but since the extensions of 2021-01-16, OCLPS supports ordering by following singlelinks to add attributes when ordering multiple single links steps away. Mind you, ordering on joined information reduces the result set according to the join (it is not an outer join - so data must be present in order to be included in the result set).

Watch the video: OCL Operators: orderby

Example

Given a class Car with a Name attribute, we can use the orderby ocl operator.

Car.allInstances.orderBy(Name)

This is returned in ascending order.

Error creating thumbnail: File missing