Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
QuickList.SortWith
Sorts the list with together with other lists.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
List | 6.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
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 |
Result
Returns OK or error.
Description
Sorts the list with together with other lists.We sort the first list and move all items in other lists as well to match the order.
You can pass as many lists in the parameters as needed, not just 2.
Add mode 16 for flags to sort by numbers for version 11.0.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat List2 parameter as often as you need.
Examples
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.Release"; $keys)]
Set Variable [$r; Value:MBS( "QuickList.Release"; $cities)]
Set Variable [$r; Value:MBS( "QuickList.Release"; $firstnames)]
Set Variable [$r; Value:MBS( "QuickList.Release"; $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.Release"; $QuickList1 ) ]
Set Variable [ $r ; Value: MBS( "QuickList.Release"; $QuickList2 ) ]
See also
- List.CrossProduct
- List.DeCombine
- List.Sort
- QuickList.DeCombine
- QuickList.GetList
- QuickList.New
- QuickList.Release
- QuickList.SetList
- QuickList.Sort
Release notes
- Version 11.0
- Added mode 16 for number sorting to QuickList.SortWith function.
- Version 10.2
- Added List.SortWithEvaluate and QuickList.SortWithEvaluate functions to sort lists with custom expression.
Blog Entries
- Neues MBS FileMaker Plugin 11.0
- MBS FileMaker Plugin 11.0 - More than 6400 Functions In One Plugin
- MBS FileMaker Plugin, version 10.6pr2
- MBS FileMaker Plugin, version 6.2pr2
This function checks for a license.
Created 25th March 2016, last changed 14th December 2023