Sort dateTime Broken in Rev 2.9?
Peter Reid
preid at reid-it.co.uk
Mon Apr 14 03:30:24 EDT 2008
Thanks for the idea, unfortunately it still doesn't work even though
I've changed the sortTable handler to the following:
on sortTable
set the useSystemDate to true
set the itemDelimiter to tab
put the radioPick of group "SortOrder" into theOrder
switch the radioPick of group "SortColumn"
case 1 -- numbers:
if theOrder = "ascending" then
sort lines of field "TheTable" ascending numeric by item 1 of
each
else
sort lines of field "TheTable" descending numeric by item 1 of
each
end if
break
case 2 -- letters:
if theOrder = "ascending" then
sort lines of field "TheTable" ascending international by item
2 of each
else
sort lines of field "TheTable" descending international by
item 2 of each
end if
break
case 3 -- dates:
if theOrder = "ascending" then
sort lines of field "TheTable" ascending dateTime by item 3 of
each
else
sort lines of field "TheTable" descending dateTime by item 3
of each
end if
break
end switch
end sortTable
In fact now the third column doesn't change at all when sorted in
either direction. Previously it changed to an incorrect order, but
it did change. Now nothing happens, the table remains the same
unless I select to sort on the numbers or letters columns which still
work correctly. I have run this in debug mode and set the break
point just before the sort and checked that it is being executed, it
just doesn't have any effect!
STOP THE PRESS - FOUND THE SOURCE OF THE PROBLEM!!
I've found the source of the problem. In Mac OS X, I had changed the
time and date display such that the whole of the International
Formats tab now showed 'Custom' instead of 'United Kingdom'. I had
the short date as D/M/YYYY (i.e. no leading zeros for day & month)
and 12hr clock with lower case am/pm indicators. This conforms to
what many people in the UK think of as standard date and time
indicators. Unlike what Apple has as defaults for UK date and time
that are NOT what most people here think of as correct - 24hr clock,
with capital AM/PM indicators if you switch to 12hr clock. In
general people in the UK use 12hr clocks unless they are military
etc. and tend to use lower case am/pm indicators. In continental
Europe, I believe 24hr clocks are more the norm.
Just having a 12hr clock makes the setting 'Custom' instead of
'United Kingdom' and then Rev's dateTime sort may stop working!!
What's weird is that I've now set my time prefs back to what I had
previously (when nothing was happening) and now Rev is working OK.
It's as if the time/date settings were not being picked up correctly
by Rev until I changed them. Rev's dateTime sort now works even
though the previous changes to the default settings are back in place.
Is there a way to tell Rev to use a specific format for time & date
(at least for sorting purposes) irrespective of the system settings
and any default behaviour? At least I could lock-down its behaviour
for sorting purposes even if my user has tweaked their time & date
settings. The dateFormat function returns the format Rev is using,
but I don't see how you change this?
Cheers
Peter
On 14 Apr 2008, at 2:25 am, Sarah Reichelt wrote:
>> on preOpenStack
>> set the useSystemDate to true
>> send "initRadio" to group "SortColumn"
>> send "initRadio" to group "SortOrder"
>> end preOpenStack
>>
>> I'm using a Mac running OS X 10.4.11 in the UK and the test dates
>> in the
>> third column of the table field are all UK format dates.
>
> I think I've found it. You will have to set the useSystemDate every
> time in the sort handler. Here is a quote from the docs on
> useSystemDate:
>
> "Since the useSystemDate is a local property, its value is reset to
> false when the current handler finishes executing. It retains its
> value only for the current handler, and setting it in one handler does
> not affect its value in other handlers it calls."
>
> Cheers,
> Sarah
> _______________________________________________
> 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