help... sort list (^._.^)?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

help... sort list (^._.^)?

Post by Mariasole »

Hello everyone!
I'm trying to sort this list but I can not do it!
Where am I wrong? :oops:

i would:
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaa
aaaaa
aaa

not:

aaaaaaaaa
aaaaa
aaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaa



Thank you aaaaaaaall! :wink:



Mariasole
(^._.^)?
Attachments
Descending list.zip
(595 Bytes) Downloaded 279 times
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: help... sort list (^._.^)?

Post by sefrojones »

This works(for your example at least):

Code: Select all

sort fld "list" descending
--sefro
Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: help... sort list (^._.^)?

Post by Mariasole »

sefrojones wrote:This works(for your example at least):

Code: Select all

sort fld "list" descending
--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? :roll:

Thanks for the help!

Mariasole
(^._.^)?
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: help... sort list (^._.^)?

Post 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
Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: help... sort list (^._.^)?

Post by Mariasole »

sefrojones wrote: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

Thanks sefro! :D
you helped me so much!
I think, however, the LiveCode Team should enhance the function of lenght sorting! :wink:

Mariasole
(^._.^)?
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: help... sort list (^._.^)?

Post 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
8)


Best

Klaus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10502
Joined: Wed May 06, 2009 2:28 pm

Re: help... sort list (^._.^)?

Post 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
Post Reply