Hi ,
I have a TI process which adds an element to the dimension in run time .
IF (DIMIX('Inventory Movement Types', vMovementType) = 0);
DIMENSIONELEMENTCOMPONENTADD('Inventory Movement Types','All Inventory Movement Types', vMovementType,1.000000);
I have a parent All Inventory Movement Types created in the inventory movement type dimension .
now the load file has a new value Z21 and this is added to the dimension but it is added as COnsolidated Element . I want it to be a leaf level element .
Not sure why its adding as a consolidated . Am i doing something wrong in the above code.
Thanks,
Adding element to a dimension at run time in TI
-
- Posts: 128
- Joined: Tue May 23, 2017 12:45 pm
- OLAP Product: Tm1
- Version: 9.5
- Excel Version: 2010
-
- MVP
- Posts: 3120
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.0.9.18
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Adding element to a dimension at run time in TI
Code: Select all
IF( DIMIX('Inventory Movement Types', vMovementType ) = 0 );
DIMENSIONELEMENTINSERT('Inventory Movement Types','', vMovementType,'N');
DIMENSIONELEMENTCOMPONENTADD('Inventory Movement Types','All Inventory Movement Types', vMovementType,1);
ENDIF;
Best regards,
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 128
- Joined: Tue May 23, 2017 12:45 pm
- OLAP Product: Tm1
- Version: 9.5
- Excel Version: 2010
Re: Adding element to a dimension at run time in TI
Thanks !! But its odd some time with just dimensionelement component add some items are added as n level .
But its safer to have the above code .
But its safer to have the above code .
-
- MVP
- Posts: 3120
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.0.9.18
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Adding element to a dimension at run time in TI
Absolutely, use both functions.
Best regards,
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- MVP
- Posts: 1815
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: Adding element to a dimension at run time in TI
I always just use dimensionelementcomponentadd without first doing an insert when it's for n level elements.
TM1 will always make an element be an N level if it is put through a dimensionelementcomponentadd and doesn't already exist.
The only time it will be a C level is if it already existed before the component add and was already a C level element.
If the element already exists at C level and you do a dimensionelementinsert with an N flag; it will be converted to an N. You can consider this safer but I would be inclined to spend more time understanding why it already existed as a C level element.
TM1 will always make an element be an N level if it is put through a dimensionelementcomponentadd and doesn't already exist.
The only time it will be a C level is if it already existed before the component add and was already a C level element.
If the element already exists at C level and you do a dimensionelementinsert with an N flag; it will be converted to an N. You can consider this safer but I would be inclined to spend more time understanding why it already existed as a C level element.
Declan Rodger
-
- MVP
- Posts: 3120
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.0.9.18
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Adding element to a dimension at run time in TI
That's the question of the OP I guess. There is a Dimix and still (based on what I read in the question) an element gets created as a C-type element.
Are you sure about that Declan ?
If an element exists as C and you try to insert the same element as N, nothing happens.
Best regards,
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- MVP
- Posts: 1815
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: Adding element to a dimension at run time in TI
Sorry you are correct about this, a dimensionelementinsert statement is completely ignored if the element already exists. I should have said if you do dimensionelementdelete and then dimensionelementinsert it changes.Wim Gielis wrote: ↑Thu Aug 03, 2017 9:52 pm Are you sure about that Declan ?
If an element exists as C and you try to insert the same element as N, nothing happens.
Yes, the dimix would stop it ever running the code if the element already exists. But a dimensionelementcomponentadd has never created a new C-level element in my experience; so all I can assume is that the element already existed as C as a child of that element; or there is another section of code somewhere that adds it in as a C.Wim Gielis wrote: ↑Thu Aug 03, 2017 9:52 pm That's the question of the OP I guess. There is a Dimix and still (based on what I read in the question) an element gets created as a C-type element.
Declan Rodger
-
- MVP
- Posts: 3120
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.0.9.18
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Adding element to a dimension at run time in TI
I agree on both points
Best regards,
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly