Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3    Statistic  

QuickList.SortWith

Sorts the list with together with other lists.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
List 6.2 Yes Yes Yes Yes Yes

MBS( "QuickList.SortWith"; ListRef; Flags; List1 { ; List2 } )

Parameters

Parameter Description Example value
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.
1
List1 The first list to sort with. $list1
List2 Optional
The second list to sort with.
$list2

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.

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.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)]

See also


QuickList.Sort   -   QuickList.ValueIndex

Feedback: Report problem or ask question.




Links
MBS FileMaker blog