Page 1 of 1
Sorting
Posted: Wed Mar 17, 2010 3:03 am
by Glenn Boyce
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
Re: Sorting
Posted: Wed Mar 17, 2010 9:20 am
by Klaus
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
Re: Sorting
Posted: Wed Mar 17, 2010 10:36 am
by jmburnod
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
Re: Sorting
Posted: Wed Mar 17, 2010 1:28 pm
by BvG
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
Re: Sorting
Posted: Wed Mar 17, 2010 1:32 pm
by Klaus
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"

Re: Sorting
Posted: Wed Mar 17, 2010 1:36 pm
by BvG
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.
Re: Sorting
Posted: Wed Mar 17, 2010 1:58 pm
by Klaus
Your bad

Re: Sorting
Posted: Thu Mar 18, 2010 8:35 pm
by dunbarx
My comment, ahem.
An old HC trick.
Craig Newman