Sort in tree of groups and items

Discussion forum for PivotCube VCL users. Common questions. Bug and problem reports

Moderator: Alex Zencovich

Sort in tree of groups and items

Postby wjsantana » Mon Nov 12, 2007 4:27 pm

Alex,

I build an internal structure of the cube (tree of groups and items).
How the cubes sort this structure? When I rebuild this structure (identical with an original structure build by cube), the sort that the cube show don’t is the some that is should originality.
I have to sort identically, how I do it?

Tks
Wesley
wjsantana
Developer
 
Posts: 20
Joined: Thu Feb 01, 2007 11:04 am
Location: Brazil

Postby AlexZencovich » Mon Nov 12, 2007 6:15 pm

if dimension is unsorted by default (ddsNoSort in TPivotCube.Dimensions[].SortBy) it will appeared in order of adding item in dimension list. If dimension loaded while cube build (DImension.DataSet = Facts) it will in like if you will do like

select unique dimensionKeyField from facts
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 wjsantana » Tue Nov 13, 2007 5:25 pm

The order should by cube don’t is the same order that the groups are build. Example:
The cubes A, B and C is build and in this order, one by one was build, save the cube, reload and after build other.
The cube should its groups in this order: A, C B
After this operation the group D is adds in cube, after reload this is the order should:

D, A, B, C.
C, B, E D, A.
D, C, F, E, B, A.

This apparent a tree order!! But I don’t identify how this is built.
Do you no what is happen whit this sort?
wjsantana
Developer
 
Posts: 20
Joined: Thu Feb 01, 2007 11:04 am
Location: Brazil

Postby AlexZencovich » Tue Nov 13, 2007 6:14 pm

Please, describe step by stap what are you do. Sorry, but I could not understand which groups you add and how you do that addition
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 wjsantana » Wed Nov 14, 2007 11:13 am

Given the structure filled by the original source data in a dimension:
Items: 1, 2, 3, 4, 5

These items appear in the order in which they were loaded : 1, 2, ... 5

After creating the group A: 1, 2, 3, 4, A
This structure is saved and loaded again


After creating the group B: 1, 2, 3, B, A
This structure is saved and loaded again


After creating the group C: 1, 2, C, A, B
This structure is saved and loaded again

Note that the order not remains the same in which the groups were created because this should be 1, 2, A, B, C
wjsantana
Developer
 
Posts: 20
Joined: Thu Feb 01, 2007 11:04 am
Location: Brazil

Postby AlexZencovich » Wed Nov 14, 2007 6:17 pm

When you load map from stream/XML it will resort dimension accordin to sort order which was saved with dimension.
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 wjsantana » Thu Nov 22, 2007 11:47 am

Alex,

We aren’t uses the XML that the cube build. To save the cube we build an structure identical a groups and we save that on database.
When an cube is rebuild the data are upping how have any group and also this process we remold this internal structure with the structure save on database.
In this process this structure the sort don’t stay correct, the order that the groups is build aren’t the same order that its are should on screen.

Tks
Wesley
wjsantana
Developer
 
Posts: 20
Joined: Thu Feb 01, 2007 11:04 am
Location: Brazil

Postby AlexZencovich » Thu Nov 22, 2007 5:23 pm

You should re-sort dimension by set appropriate value DefaultSort property of TMapDImension. Otherwise it will unsorted always.

if you need custom sort by oyur own criteria - set OnDimensionSort event handler and make own comparison of dimension items
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 wjsantana » Fri Nov 23, 2007 7:26 pm

OK, I found event OnDimensionSort, but as I use it?
wjsantana
Developer
 
Posts: 20
Joined: Thu Feb 01, 2007 11:04 am
Location: Brazil

Postby AlexZencovich » Fri Nov 23, 2007 8:12 pm

Use it to compare 2 items and return result in Compare (0 - for equal, -1 - if item1< item2...)

it will called when you set Dimension.DefaultSort to ddsSortByCustom
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


Return to PivotCube VCL

Who is online

Users browsing this forum: No registered users and 5 guests

cron