KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: List and List Box Sorting
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: December 13, 2005
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Contents of the two main types of lists in 4D (Hierarchical List and List Box) are both sortable, and use a distinct sorting command for each type.

Hierarchical lists are sorted with SORT LIST command, while list boxes use SORT LISTBOX COLUMNS command. Difference between these two commands is that SORT LISTBOX COLUMNS requires specification of a sorting column, while SORT LIST doesn't.

Examples:

SORT LISTBOX COLUMNS (*; "FormListBox";3;>) - sorts by third column of FormListBox list box

SORT LIST (ListRef; >) - sorts list referenced in ListRef in ascending order

Note that SORT LIST requires REDRAW LIST (ListRef) command executed afterward in order to display sorted content.