How to sort numbers ? [Solved]

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
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

How to sort numbers ? [Solved]

Post by atout66 » Tue Jun 30, 2015 1:03 pm

Hi to all,

I try to sort numbers which are in item 2 of a line.
Here is my code:

Code: Select all

set the itemDelimiter to "|"     -- a line of laListePartielle  = <abaque|12456|abak|FALSE|2> for example
     sort laListePartielle ascending by item 2 of each
In fact, it doesn't sort anything :?

Have you an idea why ?
Thanks in advance, Jean-Paul.
Last edited by atout66 on Tue Jun 30, 2015 1:19 pm, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to sort numbers ?

Post by Klaus » Tue Jun 30, 2015 1:07 pm

Bonjour Jean-Paul,

just wrong/incomplete syntax (dictionary, hint, hint)! 8)
...
sort LINES OF laListePartielle ascending NUMERIC by item 2 of each
...
will do the trick!


Best

Klaus

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: How to sort numbers ?

Post by atout66 » Tue Jun 30, 2015 1:19 pm

Oups, I apologize, but as you probably noticed already, there is no such example in the dictionary...
I tried also:
sort laListePartielle ascending by numeric by item 2 of each but got an error syntax of course !

At least I hope this tread will help beginners like me if they search the forum with <sort numbers> keyword.

Merci pour ton aide Klaus :wink:
Discovering LiveCode Community 6.5.2.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to sort numbers ? [Solved]

Post by Klaus » Tue Jun 30, 2015 1:21 pm

From the dictionary:
...
sort lines of tData descending numeric by item 1 of each
...
But that was under -> sort container :D


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to sort numbers ? [Solved]

Post by jacque » Tue Jun 30, 2015 4:19 pm

Sorting by lines is the default if no chunk is specified, so the original should have worked. Something odd is going on. What version of LiveCode are you using?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: How to sort numbers ? [Solved]

Post by dunbarx » Tue Jun 30, 2015 6:36 pm

The:

"by numeric" will throw an error, but the first code fragment did not contain that. That first post works fine.

Craig

Post Reply