Sort dateTime Broken in Rev 2.9?

Peter Reid preid at reid-it.co.uk
Sun Apr 13 20:33:03 EDT 2008


Thanks for the feedback Sarah.

After sending my previous message I too put together a simple test  
stack which just confirmed that dateTime doesn't work on my system!

My test stack consists of a table field with three columns, the first  
with numbers (1, 3, 5, 7, 9), the second with letters (a, c, e, x, y)  
and the third with dates (13/1/2008, 23/2/2008, 1/1/2008, 1/4/2008,  
2/2/2008).  I have two radio groups SortColumn: 1, 2 or 3, and  
SortOrder: Ascending or Descending.  When mouseUp is sent to either  
radio group it calls a sortTable handler:

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

and the stack starts with:

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.

The number and letter columns sort correctly, the date column does  
not!  In ascending order, I get the dates in the following order  
23/2/2008, 13/1/2008, 1/1/2008, 1/4/2008, 2/2/2008.  In descending  
order I get: 2/2/2008, 1/4/2008, 1/1/2008, 23/2/2008, 13/1/2008.

So either I'm doing something stupid, missing out something, or  
there's a bug!

Cheers

Peter

On 13 Apr 2008, at 10:26 pm, Sarah Reichelt wrote:
> On Sun, Apr 13, 2008 at 8:21 PM, Peter Reid <preid at reid-it.co.uk>  
> wrote:
>> Has anyone found a problem with sorting using dateTime as the sort  
>> type with
>> Rev 2.9?
>>
>>  I have a stack which has been running OK with previous Rev  
>> releases that
>> displays a table with a number of columns containing different  
>> types of data
>> Some columns contain text (surnames), some contain numbers (staff  
>> IDs) and
>> some contain dates (interview date). The user clicks on the column  
>> heading
>> to sort the table as required, with each click reversing the  
>> direction of
>> the sort ascending/descending.
>>
>>  With Rev 2.9, the sorting works for the text and numeric columns  
>> but not
>> the date columns, which contain dates in UK format (DD/MM/YYYY).   
>> If I step
>> through in debug mode the sort command executes, but there is no  
>> change to
>> the field itself.  The two sort commands I use for the date  
>> columns are as
>> follows depending on the required sort order:
>>
>>   sort lines of field "Results" descending dateTime by item colNo  
>> of each
>>   sort lines of field "Results" ascending dateTime by item colNo  
>> of each
>
> I just did a quick test and it worked fine for me. Don't forget to set
> the useSystemDate to true before sorting.
> I presume you are sure the itemDelimiter is set correctly.
>
> If it was working in a previous version, these must have already been
> set, so I can't see what might be happening, but sort dateTime does
> work for me with 2.9.0.
>
> 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