Sorting cards

Quentin Long cubist at aol.com
Thu Dec 30 15:52:29 EST 2021


sez J. Landman Gay:> I am converting an old stack to LC and it needs to sort cards by one of two fields. LC does 
> stable sorts, so if I sort by field 1 it works, and then if I sort later by field 2 it retains 
> the original sort and does a sub-sort. I don't want that. What's the best way to ignore the 
> previous sort order?

Hmmm… how about this?
1. Give each card a custom property, call it "SortValue" or some such.2. *Before* the first sort: Go thru each card and set the SortValue of each card to an integer, incrementing the number by 1 with each new card.3. *After* the first sort: Do a new sort, by the SortValue of each card. This should get the former order of the cards back.
If you do this, you can obviously re-assign the card-values of SortValue at any time, hence you can restore any arbitrary card-order you want with a fresh "sort by SortValue of each card".

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].


More information about the use-livecode mailing list