Altering element from N to C and attribute values

Post Reply
buncikp
Posts: 16
Joined: Tue Feb 12, 2013 7:31 am
OLAP Product: TM1+Cognos Express
Version: 9.5.2+10.1+10.2
Excel Version: 2007+2010
Location: Prague

Altering element from N to C and attribute values

Post by buncikp »

Hello,
Have you ever noticed that when adding an N-element to different N-element (future parent) to form a consolidation (thus altering the future parent element from N to C "automatically") will cause loss of attributes on the future parent element? I believe this method worked fine in versions <=10.1. Now in >=10.2 it seems that something is different?
Example (pseudocode):
1) Let's create future parent first as N element and set some attribute values

Code: Select all

DimensionElementInsertDirect(dimName, '', 'future parent', 'N');
AttrInsert(dimName, '', 'test n attr', 'n');
AttrPutN(100, dimName,  'future parent', 'test n attr');
Now we should have "future parent" in our dimension with attribute value set.

2) Now let's create new element and insert it as a child of future element. Inserting element as a child to N-element should alter N-element to C-element.

Code: Select all

DimensionElementInsertDirect(dimName, 'child', '', 'N');
DimensionElementComponentAddDirect(dimName, 'future parent', 'child', 1);
Now we have C-element "future parent", but we have lost attribute value on it.
Is it just me seeing this or others? Do you have any clue why this is happening?
Thank you
BrianL
MVP
Posts: 264
Joined: Mon Nov 03, 2014 8:23 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2 PA2
Excel Version: 2016

Re: Altering element from N to C and attribute values

Post by BrianL »

When you change an element from leaf to consolidated (in either direction) you are essentially deleting the leaf element and creating new consolidated element. There was a bug in 10.1 where the direct dimension edit TI functions did not correctly implement this.

Would you really want cube data to persist after changing an element from leaf to consolidation and adding child elements? That could lead to incorrect values in your data.
buncikp
Posts: 16
Joined: Tue Feb 12, 2013 7:31 am
OLAP Product: TM1+Cognos Express
Version: 9.5.2+10.1+10.2
Excel Version: 2007+2010
Location: Prague

Re: Altering element from N to C and attribute values

Post by buncikp »

BrianL wrote:When you change an element from leaf to consolidated (in either direction) you are essentially deleting the leaf element and creating new consolidated element. There was a bug in 10.1 where the direct dimension edit TI functions did not correctly implement this.

Would you really want cube data to persist after changing an element from leaf to consolidation and adding child elements? That could lead to incorrect values in your data.
Hello Brian,
I'm quite sure that the attribute values persisted the change in 9.5.X versions. I have tried it now and I have realized that this is happening due to usage of xxxDirect functions - new to TM1 10.X (direct commit is provided with each metadata change). If you use traditional non-direct functions, the attribute value is retained correctly. Of course data on the parent node will be lost as they are subject to aggregation calculation.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Altering element from N to C and attribute values

Post by tomok »

buncikp wrote:I have tried it now and I have realized that this is happening due to usage of xxxDirect functions - new to TM1 10.X (direct commit is provided with each metadata change).
A nice little nugget of information you should have included in the original post.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
qml
MVP
Posts: 1097
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Altering element from N to C and attribute values

Post by qml »

tomok wrote:A nice little nugget of information you should have included in the original post.
He did, in his code:
buncikp wrote:

Code: Select all

DimensionElementInsertDirect(dimName, 'child', '', 'N');
DimensionElementComponentAddDirect(dimName, 'future parent', 'child', 1);
Kamil Arendt
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Altering element from N to C and attribute values

Post by tomok »

Yes. sorry.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: Altering element from N to C and attribute values

Post by paulsimon »

Hi

I am not sure if it will help but try including DimensionUpdateDirect(DimName); in the Epilog

Regards

Paul Simon
Post Reply