help with custom sort

FlexibleLearning at aol.com FlexibleLearning at aol.com
Thu Oct 20 02:07:08 EDT 2005


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
-----  




More information about the Use-livecode mailing list