Hmmm. It isn’t that the “D” is concatenated onto the “ABC, (that would never happen) but rather that the word ”ABC” comes before “AB”, but only if there is a second word in each line:
ABC AB Sorts to AB ABC ——————— BUT: ABC XXX AB XXX sorts to: ABC XXX AB XXX Not sure I get this. Craig > On Mar 30, 2022, at 5:16 PM, Paul Dupuis via use-livecode > <use-livecode@lists.runrev.com> wrote: > > 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 > > > > _______________________________________________ > 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