Confirm sort container order...

Paul Dupuis paul at researchware.com
Wed Mar 30 17:16:05 EDT 2022


On 3/30/2022 4:39 PM, Craig Newman via use-livecode wrote:
> Paul
>
> I just reread your earlier post. Did you mean concatenating as if each line became a single long word? That would never do, of course, and is not how the line of code works.
>
>

This is what I was referring to:

Input data: (note line 5)
ABE XYZ GGG
ACB XYZ GHH
ABC XYZ DEF
AAB XYZ GGG
AB D GHH
AAA XYZ DEF

sortlines oftText by word 1 ofeach & word 2 ofeach & word 3 ofeach

Gives:

AAA XYZ DEF
AAB XYZ GGG
ABC XYZ DEF
AB D  GHH
ABE XYZ GGG
ACB XYZ GHH

Note line 4 should come before line 3 as "AB" should sort before "ABC" 
but in the sort above it gets concatenated with the "D" in column 2 to 
form ABD which places it between ABC and ABE. The concatination can 
cause errors in the sort order depending upon the actual data being 
sorted. However, if you sort as follows:

   sort lines of tText by word 3 of each
   sort lines of tText by word 2 of each
   sort lines of tText by word 1 of each

You get it sorted correctly:

AAA XYZ DEF
AAB XYZ GGG
AB D  GHH
ABC XYZ DEF
ABE XYZ GGG
ACB XYZ GHH





More information about the use-livecode mailing list