Problem with TMapDimensionItem.FKey

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

Moderator: Alex Zencovich

Problem with TMapDimensionItem.FKey

Postby DandyS » Wed Dec 13, 2006 8:52 am

Hello,
I have problem with TMapDimensionItem.FKey or I can't use Dimension.KeyField . I suppose when my dimension KeyField is and dimension.FieldName are different, then in TMapDimensionItem are TMapDimensionItem.FKey=(value from Dimension.KeyField) and TMapDimensionItem.FName=(value from Dimension.FieldName).
But TMapDimensionItem.FKey is value from Dimension.FieldName same as TMapDimensionItem.FName.
If my idea is wrong, where I can find value from Dimension.KeyField in TMapDimensionItem or somewhere similar.

1st. problem is in dimension sort by key and sort by name. It's make same result.
2nd. is my bigger problem, where i have cube in difrent language and I have for example column no. of ware and name of ware. In other languages no. of wares are same and names of wares are difrend. Then I want filter and save some ware in firts language and load in other language. So I(customer) want set filter as name of ware(dimension.fieldname) and save as no. of ware(dimension.keyfield). But I can't do this :(. Do you have any solution for me?
Tahnk...
Last edited by DandyS on Wed Dec 13, 2006 9:41 am, edited 1 time in total.
DandyS
User
 
Posts: 10
Joined: Thu Nov 23, 2006 8:56 am
Location: CZ

Postby AlexZencovich » Wed Dec 13, 2006 9:48 am

1. TMapDimensionItem.Key = TPivotCube.Dimensions[].KeyField Value
2. Filtering use TMapDImensionItem.ID value to set filters. ID value assigned autoomatically when dimension loaded (on cube build stage). There are no difference which language you have used, ID still the same and used to internal cube navigation.
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

KeyField

Postby DandyS » Wed Dec 13, 2006 12:28 pm

1. I looked for this in Demo project. It works correctly If I have fakt table dataset difrent then dataset in dimension. If I have same dataset in both (fact table dataset and dataset at dimension), then TMapDimensionItem.key = TMapDimensionItem.name= value from dimension.FieldName.
For example I have aEmployer from Demo as factTableDataSet and I have 1 dimension Employer >
AliasName = 'Employer'
FieldName = 'Name'
DataSet = aEmployer
KeyField = 'ID'
LookupField = 'Name'

and result of fields
PivotMap1.Dimensions[0].Items[1].ID=3
PivotMap1.Dimensions[0].Items[1].key=Bender
PivotMap1.Dimensions[0].Items[1].name=Bender

Then if I use filter (dimItem.state Bender set to disFiltered) and save map SaveToXMLRSV then procedure SaveDimItem save KeyNode.nodeTypedValue := Item.Key;

In next step I change Bender to Bender2 in database(ID as keyfield doesn't change , I want that Bender=Bender2 by ID). Now I used LoadFromXML, but now PivotMap1.Dimensions[0].Items[1].key=Bender2 and Bender2 isn't filtered as disFiltered. It isn't in this example filtred by KeyField = 'ID' but wrong as FieldName = 'Name'. PivotMap1.Dimensions[0].Items[1].key<>value from dimension Employer KeyField = 'ID' :(.

I hope that I havent any mistake in my experiment, but I think it works as I wrote.

I don't know if I can use TMapDImensionItem.ID, becourse betwean save and load xml Data may be changed. I have to check up it.
DandyS
User
 
Posts: 10
Joined: Thu Nov 23, 2006 8:56 am
Location: CZ

Postby AlexZencovich » Wed Dec 13, 2006 1:09 pm

Yes, if you have facts dataset = dimensiion dataset, it mean you have same value as key and name so in that case Key=Name. It was done because in that case we cannot be sure you have unique Keys in your dataset (moreover, we should expect many duplicates because facttable usually much larger than dimension data)

You may avoid that by place additional dataset as dimension dataset with SQl clause like

select distinct DimKey,DimName from FactsTable


In that case all will works as you expected.
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 DandyS » Wed Dec 13, 2006 2:33 pm

Thanks for answer. I understand why yuo use this solutions, but may be if i used KeyField then I suppose it is unique(it's programers responsibility :) ). Of course when keyfield and field name isn't unique, you have problem :(.

I resolve my problem difrend way for now.


Just I bring back problem with sorting dimension by key. I don't know, if it's same problem (I thing). If I used in previous example sort dimenion by Key, then result is same as sort dimension by name.
DandyS
User
 
Posts: 10
Joined: Thu Nov 23, 2006 8:56 am
Location: CZ

Postby AlexZencovich » Wed Dec 13, 2006 3:12 pm

1. When DImension dataset = Facts then keyField/LookupField values means nothing. Just not used in cube build. Only FieldName still used.

2. If KeyField=Name = sorting will the same in both cases of course.
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 0 guests

cron