Please enable JavaScript to view this site.


void = List_Sort(sListVarName)


This macro function is sort all the entries of an existing list based on each entry's string value (the associated number values are ignored).


A call to List_Sort sorts the items of the list at the time it is called, but does not make the list "sorted". That is to say, if you add more items to your list, and you want the increased list to be sorted, then you will need to call List_Sort again.


Consider the macro code below, which adds some entries to a list, calls List_Sort, and then calls various list functions to get back some information.

// put some values in the list
List_Add(sListCountries, 'Egypt=Ägypten'10133)     // item 1
List_Add(sListCountries, 'Albania=Albanien'10165)  // item 2
List_Add(sListCountries, 'Algeria=Algerien'10183)  // item 3
List_Add(sListCountries, 'Andorra=Andorra'10167)   // item 4
List_Add(sListCountries, 'Armenia=Armenien'10180)  // item 5
// remove duplicates
// now get some information back from the list
sResult = List_GetString(sListCountries, 1// 'Albania=Albanien' 
sResult = List_GetString(sListCountries, 2// 'Algeria=Algerien' 
sResult = List_GetString(sListCountries, 3// 'Andorra=Andorra' 
sResult = List_GetString(sListCountries, 4// 'Armenia=Armenien' 
sResult = List_GetString(sListCountries, 5// 'Egypt=Ägypten'

When using lists, don't forget to always use the function List_Create to create your list at the top of the macro, and then the function List_Destroy to destroy it at the end of the macro.


See also: list macro functions.


Topic 178365, last updated on 18-Apr-2020