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.

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.

Details: two fields, named "title" and "category". Sort by field "category", works. Later on, sort by field "title" -- no change. I tried this:

  sort cards by random(10000) -- mix them up
  sort cards by field "title"

also:
  sort cards numeric by the short ID of this card -- put them back in natural 
order
  sort cards by field "title"

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.

On 12/30/21 9:25 AM, Alex Tweedly via use-livecode wrote:
You shouldn't need to ignore the previous sort. The second sort over-rides the first; it's only when looking at those cards which have the same value for the second field that the previous sorting applies.

So if we have

A2 B1 A1 C3

If we sort by char 2 of each, we would get    B1 A1 A2 C3 (nb - all with a 1, then all with a 2, ...)

and THEN sort by char 1 of each, we get   A1 A2 B1 C3 (all A then all B then 
all ..., )

If we have A2 B1 A1 C3 and sort by char 1 of each, we get A2 A1 B1 C3 (all As before Bs, ... and within the As they remain in the same order as they were).

Hmmm - not sure if that's clear or not.

Other way to think of it : a stable sort means that items which have matching keys remain in the same relative position.

Alex

(P.S. you're perhaps mixing up "first" and "second" - if want them "properly" sorted, you do the less important one (minor) first, then the major one. Hope that doesn't muddy it any more.)


On 30/12/2021 06:41, J. Landman Gay via use-livecode wrote:
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?

I've tried a number of things with no luck.


_______________________________________________
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


--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
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