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 » Wed Mar 25, 2015 7:34 pm

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 222 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 » Wed Mar 25, 2015 7:46 pm

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 » Wed Mar 25, 2015 7:58 pm

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 » Wed Mar 25, 2015 8:09 pm

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 » Wed Mar 25, 2015 8:31 pm

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: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Thu Mar 26, 2015 12:04 pm

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: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Thu Mar 26, 2015 2:23 pm

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