Page 1 of 1

Sort date grid by date items

Posted: Thu Jan 08, 2015 8:45 am
by shoshinsha
Hi,

I have a Data Grid that contains a "date" field (converted to dateItems) per row.
My problem is whenever I sort the datagrid by date, the dates are not sorted as ascending/descending as I wanted to.
For example:

Code: Select all

 dispatch "SortDataByKey" to grp "tgrid1" with "date", "international", "ascending", "false"
After sorting, I got:
2014,10,8,13,12,22,25
2014,12,25,9,13,5,26
2014,2,13,6,0,48,7
2014,2,13,6,52,48,2
2014,5,5,11,29,6,3
2014,5,5,3,12,36,37
...

While the correct ascending date should be:
2014,2,13,6,0,48,7
2014,2,13,6,52,48,2
2014,5,5,3,12,36,37
2014,5,5,11,29,6,3
2014,10,8,13,12,22,25
2014,12,25,9,13,5,26
...

I've tried using normal date and time records on that field, but the months could not be sorted accordingly Jan, Feb, Mar, ..., they will be sorted in alphabetical order instead.
Any advices on how to sort for date?

Thanks in advance! :)

Re: Sort date grid by date items

Posted: Thu Jan 08, 2015 9:58 am
by shoshinsha
I figured that I can convert the date and time to seconds instead of converting to dateItems...
The way should work :wink:

Re: Sort date grid by date items

Posted: Thu Jan 08, 2015 1:35 pm
by Klaus
shoshinsha wrote:I figured that I can convert the date and time to seconds instead of converting to dateItems...
The way should work :wink:
Yes :D