gt; Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
>
> -Original Message-
> From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
> Of matthias rebbe via use-livecode
> Sent: Saturday, September 02, 2023
atthias_livecode_150...@m-r-d.de
Subject: Re: Sorting by item ... of each and item ... of each
Of course my "not working" sort code look like this
set the itemdelimiter to ";"
sort lines of tList numeric by item 3 of each and item 2 of each.
> Am 03.09.2023 um 02:59 sch
I should have given better context. I one only sorts the same field numeric,
one gets:
123
132
213
231
312
321
Which is correct given the list of whole numbers in question. The stable sort
allows one to then sort by char 3 of each, to get the result in the “compound”
sort below.
So am I
I may be simply misunderstanding…
Since HC days, one could concatenate sort criteria using the “&” character, and
obtain multiple stable sorts in one go. In LC as well, since given, in a field
1:
231
312
123
213
321
132
and in a button somewhere:
on mouseUp
get fld 1
sort it numeric by
Hello Mark,
thanks for explanation and also for your solution. I will try.
Maybe i should get my book "regular expressions" from Jeffrey E.F.Friedl from
the shelf and should finish reading it, so i could make use of regular
expressions in Livecode more often.
Regards,
Matthias
> Am 03.09
Thanks Panos,
you are right. ;) While reading your answer i remembered that i have done this
with 2 separate sorts.
I really don't know how i thought to use by sortKey1 and sortKey2
But at least the script editor did not return an error.
Should not work so late in the night.
Matthias
> Am
Thanks Phil,
i will try.
> Am 03.09.2023 um 07:22 schrieb Phil Davis via use-livecode
> :
>
> I believe this works:
>
> on mouseUp
>put fld 1 into tList
>sort lines of tList by _sortKey(each)
>put tList into fld 2
> end mouseUp
>
>
> function _sortKey pLine
>
On 2023-09-03 10:26, panagiotis m via use-livecode wrote:
Hello Matthias,
I do not think that the syntax "sort by sortKey1 and
sortKey2"
is supported
Heh technically it 'is' - and does do something but it won't be what you
expected...
So the syntax for sort in this case is:
sort by
Hello Matthias,
I do not think that the syntax "sort by sortKey1 and sortKey2"
is supported
If you have multiple sortKeys, you have to do multiple sorts, for example,
in your use case, this should work:
set the itemdel to ";"
sort lines of tList numeric by item 3 of each
sort lines of tList num
I believe this works:
on mouseUp
put fld 1 into tList
sort lines of tList by _sortKey(each)
put tList into fld 2
end mouseUp
function _sortKey pLine
set the itemDel to ";"
return item 3 of pLine & ";" & item 2 of pLine
end _sortKey
I realize
Of course my "not working" sort code look like this
set the itemdelimiter to ";"
sort lines of tList numeric by item 3 of each and item 2 of each.
> Am 03.09.2023 um 02:59 schrieb matthias_livecode_150...@m-r-d.de:
>
> Maybe i do not see the forest for the trees
>
> I have a tab delimit
Maybe i do not see the forest for the trees
I have a tab delimited list which i want to sort. I am using this code to sort
it by item 3 and item 2
set the itemdelimiter to tab
sort lines of tList numeric by item 3 of each and item 2 of each.
But that code does not sort as i expected it. Co
12 matches
Mail list logo