Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Sorts the list with together with other lists.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
List | 6.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
ListRef | The reference to the list returned from QuickList.New function. | $List | |
Flags | Optional, whether to sort case insensitive or descending. Pass 1 to sort case insensitive or 0 to sort case sensitive. Add 2 to sort descending. Add 4 for sorting dates in DD.MM.YYYY style and 8 for sorting dates in MM.DD.YYYY style. Add 16 to sort by numbers. |
1 | |
List1 | The first list to sort with. | $list1 | |
List2... | The second list to sort with. | $list2 | Optional |
Returns OK or error.
Test sorting with four lists:
# build some lists
Set Variable [$keys; Value:MBS( "QuickList.New"; "234¶123¶545¶152" )]
Set Variable [$firstnames; Value:MBS( "QuickList.New"; "Bob¶John¶Bill¶Chris" )]
Set Variable [$lastnames; Value:MBS( "QuickList.New"; "Miller¶Jones¶Becks¶Meyer" )]
Set Variable [$cities; Value:MBS( "QuickList.New"; "New York¶Santa Clara¶San Francisco¶Atlanta" )]
# show before
Set Variable [$r1; Value:MBS( "List.CrossProduct"; MBS("QuickList.GetList"; $keys); MBS("QuickList.GetList"; $firstnames); ""; ": "; ""; 2)]
Set Variable [$r2; Value:MBS( "List.CrossProduct"; MBS("QuickList.GetList"; $lastnames); MBS("QuickList.GetList"; $cities); ""; ", "; ""; 2)]
Set Variable [$r3; Value:MBS( "List.CrossProduct"; $r1; $r2; ""; ", "; ""; 2)]
# sort
Set Variable [$r; Value:MBS( "QuickList.SortWith"; $keys; 0; $firstnames; $lastnames; $cities)]
# show result:
Set Variable [$r1; Value:MBS( "List.CrossProduct"; MBS("QuickList.GetList"; $keys); MBS("QuickList.GetList"; $firstnames); ""; ": "; ""; 2)]
Set Variable [$r2; Value:MBS( "List.CrossProduct"; MBS("QuickList.GetList"; $lastnames); MBS("QuickList.GetList"; $cities); ""; ", "; ""; 2)]
Set Variable [$r4; Value:MBS( "List.CrossProduct"; $r1; $r2; ""; ", "; ""; 2)]
Show Custom Dialog ["Sort results"; "Before: " & ¶ & $r3 & ¶ &¶ & "Sorted: " & ¶ & $r4]
# cleanup memory
Set Variable [$r; Value:MBS( "QuickList.Free"; $keys)]
Set Variable [$r; Value:MBS( "QuickList.Free"; $cities)]
Set Variable [$r; Value:MBS( "QuickList.Free"; $firstnames)]
Set Variable [$r; Value:MBS( "QuickList.Free"; $lastnames)]
Sort a list column:
Set Variable [ $List ; Value: "65412|Schreiber|Klaus|459oz8235" & ¶ & "76542|Abraham|Hermmann|38957zf" & ¶ & "85112|Behrens|Robert|489748hj" ]
Set Variable [ $QuickList1 ; Value: MBS( "QuickList.New"; $list ) ]
#
Set Variable [ $QuickList2 ; Value: MBS( "QuickList.DeCombine"; $QuickList1; "|"; 1 /* StartColumn*/; 1 /* EndColumn */; 1 /* New List*/ ) ]
Set Variable [ $List2 ; Value: MBS( "QuickList.GetList"; $QuickList2) ]
Set Variable [ $r ; Value: MBS( "QuickList.SortWith"; $QuickList2; 1; $QuickList1 ) ]
Set Variable [ $List1 ; Value: MBS( "QuickList.GetList"; $QuickList1) ]
#
Set Variable [ $r ; Value: MBS( "QuickList.Free"; $QuickList1 ) ]
Set Variable [ $r ; Value: MBS( "QuickList.Free"; $QuickList2 ) ]
This function checks for a license.
Created 25th March 2016, last changed 5th June 2021