Sorting cards

Alex Tweedly alex at tweedly.net
Thu Dec 30 16:02:56 EST 2021


On 30/12/2021 19:38, J. Landman Gay via use-livecode wrote:
> Thanks for the reply. I understand how it works, my question is how to 
> make it not work that way. :) Basically, I don't want the sub-sort.

The 'sub-sort' will only have any effect if there are cards with 
identical values for the "title" field; if teh titles are unique, then 
previous sorts will be totally irrelevant.

If there are duplicate values in the title field, then those cards will 
remain in the same relative orderas they were before that sort; if 
that's not desired, then you could do either of the versions you 
included below - either randomize or put back into original (ID) order 
first.

>
> On the other hand, something may have gone wrong when sorting by the 
> first field because the order didn't change at all -- it was like I 
> never executed the command. I need to investigate that.
>
Yeah, it sounds like that's the problem.

> [ .... ] Nope, except for once. I don't know why it worked only once. 
> I'll poke around, but the question still stands for reference: how do 
> we avoid the sub-sort? Maybe one of the two examples above is the way.
>
Short answer: you don't, you can't. :-)
When you "sort by field title" you are going to get stable order for 
those cards with identical titles. You can control the fine detail of 
that (obscure corner?) case by pre-sorting appropriately - either 
random, or short ID, or category, or ....

Alex.




More information about the use-livecode mailing list