Page 1 of 1
help... sort list (^._.^)?
Posted: Wed Mar 25, 2015 7:34 pm
by Mariasole
Hello everyone!
I'm trying to
sort this list but I can not do it!
Where am I wrong?
i would:
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaa
aaaaa
aaa
not:
aaaaaaaaa
aaaaa
aaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaa
Thank you aaaaaaaall!
Mariasole
(^._.^)?
Re: help... sort list (^._.^)?
Posted: Wed Mar 25, 2015 7:46 pm
by sefrojones
This works(for your example at least):
--sefro
Re: help... sort list (^._.^)?
Posted: Wed Mar 25, 2015 7:58 pm
by Mariasole
sefrojones wrote:This works(for your example at least):
--sefro
Thank you Sefro!
but try in my stack:
jhfg
dòfjùgf
aaaa
aaa
aa
hfhfjghkjflkjhfgh
gjhfg
fjhljfgjhfklògh
also with your code you obtain:
jhfg
hfhfjghkjflkjhfgh
gjhfg
fjhljfgjhfklògh
dòfjùgf
aaaa
aaa
aa
and not:
hfhfjghkjflkjhfgh
fjhljfgjhfklògh
dòfjùgf
gjhfg
aaaa
jhfg
aaa
aa
why?
Thanks for the help!
Mariasole
(^._.^)?
Re: help... sort list (^._.^)?
Posted: Wed Mar 25, 2015 8:09 pm
by sefrojones
Check out this thread here:
http://forums.livecode.com/viewtopic.php?f=9&t=10505
--sefro
EDIT:
Code: Select all
sort fld "list" descending numeric by the length of each
Re: help... sort list (^._.^)?
Posted: Wed Mar 25, 2015 8:31 pm
by Mariasole
Thanks sefro!
you helped me so much!
I think, however, the LiveCode Team should enhance the function of lenght sorting!
Mariasole
(^._.^)?
Re: help... sort list (^._.^)?
Posted: Thu Mar 26, 2015 12:04 pm
by Klaus
Hola Maria,
Mariasole wrote:I think, however, the LiveCode Team should enhance the function of lenght sorting!
I think this
IS the best enhancement of the sorting routine:
Code: Select all
sort fld "list" descending numeric by the length of each
Best
Klaus
Re: help... sort list (^._.^)?
Posted: Thu Mar 26, 2015 2:23 pm
by dunbarx
Hi.
What Klaus said. What he means may be seen in this line from the dictionary:
The sort text form sorts by the ASCII value of each character. The sort numeric form sorts by number. Use this form if the sortKey consists of numbers.
The nature of the sortKey must be considered at all times. The point might be made a little more clearly, but just know that when sorting by the "length of each", one is sorting by a numerical, not a text value. I would post a user comment, but currently, as often happens, that feature is locked out.
Craig Newman