Sort method - SDT Collection

Official Content
This documentation is valid for:

Sorts the elements of an SDT collection variable. It also sorts a variable based on a simple data type that is a collection.


&SDTCollectionVble.Sort("[ColumnListString]")     |     &VbleThatIsCollection.Sort()

    List of SDT elements to sort in a string separated by a comma. By default ascending order is set, use [] or () to set descending order.


1) Suppose the following SDT collection variable:


To order ascending by Id:


To order descending by Id:


To order ascending by Id and descending by Number:


To order descending by Id and ascending by Number:



2) Consider the &CustomerNameCollection variable based on the Character data type.

To order ascending the collection of customer names:




Objects Procedure object, Transaction object, Web Panel object
Languages .NET, .NET Core, Java


The C# generators use the method ArrayList.Sort from the .Net framework. It compares two String objects by evaluating the numeric values of the individual Unicode characters of the strings using the CompareOrdinal method.

The Java Generator uses the standard String API to compare elements; it compares them lexicographically. The comparison is based on the Unicode value of each character in the strings.

All implement the Quicksort algorithm; equal elements do not preserve order.

See also

Structured Data Type Methods
Structured Data Type