Actually, I like Jackie’s idea better.
Make an array for each of the parameters to be sorted on. Then sort each of the 
arrays. You can access each card in the sorted order by referring to the card 
ID in the sorted array. 
Or you could put each card identifier in a text line with commas between each 
item and sort on item # of the lines.

Hope this makes sense.

Bill P

Easy peasy.
Best,
Bill P

Sent from my iPad

> On Dec 30, 2021, at 1:15 PM, William Prothero via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> It might be less work to just implement your own sorting code. I’ve found 
> them pretty easy to implement. A bubble sort is very simple, but inefficient 
> for a large number of items to sort. If you have a lot of cards, you would 
> want to use a more efficient algorithm. Check out the link below if you are 
> interested.
> 
> https://en.wikipedia.org/wiki/Sorting_algorithm
> 
> Good luck,
> Bill P
> 
> Sent from my iPad
> 
>>> On Dec 30, 2021, at 12:53 PM, Quentin Long via use-livecode 
>>> <use-livecode@lists.runrev.com> wrote:
>>> 
>> 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 ].
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to