help with custom sort
Ron Noice
ron at ecionmicroed.com
Thu Oct 20 08:46:09 EDT 2005
Thanks. I've adopted/adapted the previous idea and it worked well so I'm going to stick with it. But will keep your suggestion for future reference -- never can tell when these things will come in handy! Thanks.
... Ron
______________________________________________
*** From: FlexibleLearning at aol.com (FlexibleLearning at aol.com)
*** Dated: Thu, 20 Oct 2005 02:07:08 EDT
Hi Ron
I found this synchronized list sorting handler in the Scripter's Scrapbook.
It may need a bit of tweaking for rev, but may give you some ideas...
local lKeyData, lLineCounter
on sortBy keyField -- parallel sorting of linked flds
put fld keyField into lKeyData
put "data1,data2,data3" into dataFields -- fill in your fld names here
repeat with i = 1 to the number of items of dataFields
put 0 into lLineCounter -- must be reset prior to each sort
sort lines of fld (item i of dataFields) by key()
end repeat
end sortBy
function key
add 1 to lLineCounter
return line lLineCounter of lKeyData
end key
Based on an old HyperCard script by Brett Sher.
HTH
/H
-----
I have a field containing several items including one for month/year pairs
such as:
Oct 2005
Apr 2005
Feb 2004
Jan 2006
Apr 2005
Aug 2005
Is there any clever way to get these lines sorted chronologically? What I've
been doing so far is generating a real date from them:
Oct 1, 2005
Apr 1, 2005
etc.
in a hidden item and sorting that.
This works but I'm betting there's a way to do a custom sort thingee that
works directly from the original values. But so far I've come up with nada. Any
clever ideas?
... Ron
-----
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list