LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Wed Mar 17, 2010 3:03 am
I have been able to sucessfully sort a fld on a single item but am struggling with the syntax to get it to sort on two items. eg sort by type and then by size of that type where the type is in item 3 and size is in item 5 of each record line. this is what I have currently which does not work
Code: Select all
put fld "productSpecs" into tproductspecs
sort lines of tproductspecs by item 3 of each
sort lines of tproductspecs by item 5 of each
put tproductspecs
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Mar 17, 2010 9:20 am
Hi Glen,
...
sort lines of tproductspecs by item 3 of each && item 5 of each
...
Go figure, this is even in the docs (Rev dictionary) under "sort"
Best
Klaus
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Wed Mar 17, 2010 10:36 am
I hoped to answer but Klaus is really very fast
I had begun a script creating subcategories to be separately sorted out
The syntax proposed by Klaus works fine but I do not see it in the dictionary of RevStudio 4.0.0 950
( Maeby that i progress too slowly in english)
P.S. Klaus, some children of the hospital play with Egg-Eier with pleasure.
I shall soon send you a "defininitive" version
All the best
Jean-Marc
https://alternatic.ch
-
BvG
- VIP Livecode Opensource Backer

- Posts: 1239
- Joined: Sat Apr 08, 2006 1:10 pm
-
Contact:
Post
by BvG » Wed Mar 17, 2010 1:28 pm
I'm not so sure what klaus example does (and I can't see it in the dictionary either), but to make two sorts, the _least_ important sort has to come first. I suggest to invert the two sort lines (as shown below). That way the sort will be by item 3 first, and if several item 3 entries are equal, then item 5 will be used to sort these accordingly.
Code: Select all
put fld "productSpecs" into tproductspecs
sort lines of tproductspecs by item 5 of each
sort lines of tproductspecs by item 3 of each
put tproductspecs
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Mar 17, 2010 1:32 pm
Hi all,
I found this in the "sort" entry in the Rev Dictionary at the bottom, it is a user contribution!
It may take some time until it has been loaded.
Best
Klaus
P.S.
Great to hear the kids have fun with "Eier-Eggs"

-
BvG
- VIP Livecode Opensource Backer

- Posts: 1239
- Joined: Sat Apr 08, 2006 1:10 pm
-
Contact:
Post
by BvG » Wed Mar 17, 2010 1:36 pm
To me they're not part of the documentation, they're user comments. And of course, as I am using my own docu stack, I don't get the chance to look at those, ever.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Mar 17, 2010 1:58 pm
Your bad

-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10330
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Thu Mar 18, 2010 8:35 pm
My comment, ahem.
An old HC trick.
Craig Newman