Problem sorting dates

Useful shares from PivotCube VCL - code example, algorithm solutions etc

Moderator: Alex Zencovich

Problem sorting dates

Postby ccascante » Thu Mar 01, 2007 8:13 pm

I have a dimension that contains a date value in the next format: DD/MM/YYYY. (Latin America).

If I try to sort that list by clicking the column of the grid, the grid sorts the information in alphabetic order.

By example, if I have the next values at the grid: 01/01/2007, 01/02/2007, 03/01/2007, 02/05/2007, when I click the column to sort it in ascending order, I get that:

Date
========
01/01/2007
01/02/2007
02/05/2007
03/01/2007
========

I need the list sorted in chronological order:

Date
========
01/01/2007
03/01/2007
01/02/2007
02/05/2007
========

Please help me.
ccascante
User
 
Posts: 18
Joined: Fri Jul 07, 2006 8:46 pm

Postby AlexZencovich » Fri Mar 02, 2007 6:16 am

To fix that problem you may

1. On design stage, open TPivotCube dimensions editro, find your date dimension and set property SortBy to sortbykey

2. on runtime, open dimension editor for specifed dimension, click Sort and select SortByKey submenu, then sort in asc or desc order

3. In your application set TPivotMap.Dimensions[].DefaultSort to dmSortByKeyA


After you chnaged dimension default sort order to sort by key, click on a grid will just change sort order but will not chnage sort type (by key or by caption) until user not click by right button (unsort to default order). If user choose unsort default sorting by name returned.
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby ccascante » Fri Mar 02, 2007 5:07 pm

Thanks a lot.
ccascante
User
 
Posts: 18
Joined: Fri Jul 07, 2006 8:46 pm


Return to PivotCube VCL

Who is online

Users browsing this forum: No registered users and 1 guest

cron