4D v16.3

SORT LIST

Home

 
4D v16.3
SORT LIST

SORT LIST 


 

SORT LIST ( list {; > or <} ) 
Parameter Type   Description
list  ListRef in List reference number
> or <  Operator in Sorting order: > to sort in ascending order, or < to sort in descending order

The SORT LIST command sorts the list whose reference number is passed in list.

To sort in ascending order, pass >. To sort in descending order, pass <. If you omit the sorting order parameter, SORT LIST sorts in ascending order by default.

SORT LIST sorts all levels of the list; it first sorts the items of the list, then it sorts the items in each sublist (if any), and so on, through all the levels of the list. This is why you will usually apply SORT LIST to a list in a form. Sorting a sublist is of little interest because the order will be changed by a call to a higher level.

SORT LIST does not change the current list item nor the current expanded/collapsed state of the list and sublists. However, because the current item can be moved by the sorting operation, Selected list items may return a different position before and after the sort.

Example  

Given the list named hList, shown here in the Application environment:

After the execution of this code:

  ` Sort the list and it sublists in ascending order
 SORT LIST(hList;>)

The list looks like:

After the execution of this code:

  ` Sort the list and it sublists in descending order
 SORT LIST(hList;<)

The list looks like:



See also 

Selected list items

 
PROPERTIES 

Product: 4D
Theme: Hierarchical Lists
Number: 391

 
HISTORY 

Created: 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)