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 =A0(FlexibleLearning at aol.com)
*** Dated: Thu, 20 Oct 2005 02:07:08 EDT
=A0Hi Ron
=A0I found this synchronized list =A0sorting handler in the Scripter's=
Scrapbook.
=A0It may need a bit of tweaking for =A0rev, but may give you some ideas...
=A0local lKeyData, =A0lLineCounter
=A0on sortBy keyField -- parallel sorting of linked =A0flds
=A0put fld keyField into lKeyData
=A0put =A0"data1,data2,data3" into dataFields -- fill in your fld names =A0here
=A0repeat with i =3D 1 to the number of items of =A0dataFields
=A0put 0 into lLineCounter -- must be reset =A0prior to each sort
=A0sort lines of fld (item i of =A0dataFields) by key()
=A0end repeat
=A0end sortBy
=A0function =A0key
=A0add 1 to lLineCounter
=A0return line =A0lLineCounter of lKeyData
=A0end key
=A0Based on an old HyperCard script by =A0Brett Sher.
=A0HTH
=A0/H
=A0-----
=A0I have a field containing =A0several items including one for month/year=
pairs
=A0such as:
=A0Oct 2005
=A0Apr =A02005
=A0Feb 2004
=A0Jan 2006
=A0Apr 2005
=A0Aug 2005
=A0Is there any clever =A0way to get these lines sorted chronologically? What=
I've
=A0been doing so far is =A0generating a real date from them:
=A0Oct 1, 2005
=A0Apr 1, 2005
=A0etc.
=A0in a =A0hidden item and sorting that.
=A0This works but I'm betting there's a way to do =A0a custom sort thingee that
=A0works directly from the original values. But so far =A0I've come up with=
nada. Any
=A0clever ideas?
=A0... Ron
=A0-----
=A0_______________________________________________
=A0use-revolution mailing list
=A0use-revolution at lists.runrev.com
=A0Please visit this url to subscribe, unsubscribe and manage your=
subscription preferences:
=A0http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list