[TIP] Sorting by ValueList and synchronized sorting
Hugh Senior
FlexibleLearning at tiscali.co.uk
Thu Jun 19 14:11:54 EDT 2008
A good point, Peter. It would not affect the example as only 7 day-values
are involved, but longer value lists would indeed be affected.
on mouseUp
sort lines of fld 1 numeric by valueList(word 1 of each)
end mouseUp
function valueList what
put "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" into tList
return itemOffset(what,tList)
end valueList
/H
-----------
I believe I discovered that this custom sort function has to be
modified in one tiny way to work properly. Instead of
sort lines of fld 1 by valueList(word 1 of each)
you have to do
sort lines of fld 1 numeric by valueList(word 1 of each)
The valueList function returns a number, so the sort has to be
numeric. IIRC, this caused a problem for me until I figured it out. I
could be misremembering....
Peter M. Brigham
More information about the use-livecode
mailing list