DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post Reply
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

Hi everyone,

Below is the sample syntax I am trying to add element to Parent called 'Total Entity'.
DIMENSIONELEMENTINSERT('dimName','', xle , 'N' );
DIMENSIONELEMENTCOMPONENTADD( 'dimName', 'Total Entity', xle, 1);

Someone time the result shows elements added under 'Total Entity' as child (which I want) but some time goes outside 'Total Entity' meaning does not get added as child. What could be the reason? What I'm I doing wrong?

Regards
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin »

Check your dimension sort order. Try set to Hierarchy, by Name if not set already.
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

Not sure what that means. Do we set it from edit dimension structure? or via code? This is the code that will add elements going forward
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin »

Right click your dimension, click Set Elements Order then Automatic and Hierarchy. You can use TI to set this too, to set to Hierarchy and name, but try the right-click method first.
tomok
MVP
Posts: 2831
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: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by tomok »

It's in the }DimensionProperties cube but you can also set it via TI. Please consult the TI functions help.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

Set to sort manually by Name.
Still same issue. example below, 903 and 904 are not rolling up to Total Entity.

is below code incorrect?
DIMENSIONELEMENTINSERT('dimName','', xle , 'N' );
DIMENSIONELEMENTCOMPONENTADD( 'dimName', 'Total Entity', xle, 1);

+Total Entity
--900
--901
--902
903
904
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin »

Ashleigh W wrote: Tue Apr 10, 2018 11:24 am Set to sort manually by Name.
Currently set or was set? Did you change to automatic by hierarchy?
If you select element 903, can you roll it up to check what its parent is?
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

Initially it was not set to auto sort by Hierarchy. I have done that now.
Now after auto sort set, I deleted all elements and try adding again using code and it seems to be working. What was I doing wrong?
Also please clarify what does element weight parameter mean here in DIMENSIONELEMENTCOMPONENTADD
DIMENSIONELEMENTINSERT('dimName','', xle , 'N' );
DIMENSIONELEMENTCOMPONENTADD( 'dimName', 'Total Entity', xle, 1);
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin »

Generally when you create a hierarchy with levels, you would set sort order to Hierarchy so that it represents as a tree structure.
This however depends on your goal as you may choose manual and order elements as you want. No right answer here.

Would refer you to the manuals/online help with element weighting. But loosely, this is the multiplier used when aggregating child elements up the hierarchy.
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

ok. Thanks for your help!
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

Do I need to execute this code from MetaData tab or Prolog itself is fine?
Wim Gielis
MVP
Posts: 3103
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: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Wim Gielis »

If you have a data source, like a relational table or flat file, then probably in the Metadata tab.
If it's elements that you insert as a one-off and not through a data source, it would go in the Prolog tab.
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
tomok
MVP
Posts: 2831
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: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by tomok »

Ashleigh W wrote: Tue Apr 10, 2018 11:34 am What was I doing wrong?
You didn't do anything "wrong", it's just that the information you were giving us was "fake news". Sorry, couldn't help it. Those DIMENSIONSORT functions have absolutely NOTHING to do with how children roll up to a parent. All they control is the order of how the elements appear in a dimension. Absent a default subset, if you double-click on a dimension and open the subset editor you are going to see the elements in the order they appear in a dimension, sometimes with consolidated nodes mixed in with leaf nodes. It appears that some leaves may not appear to be a children of their parents based on this listing. However, if you were to expand the parents you would see that they are there. This was likely the case. I have never, ever seen a case where a proper use of DIMENSIONELEMENTCOMPONENTADD did not add a child to a parent and your syntax looked correct.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Mark RMBC »

it's just that the information you were giving us was "fake news"
This seems slightly harsh given fake news is the deliberate attempt to fool the gullible/stupid.
tomok
MVP
Posts: 2831
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: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by tomok »

Mark RMBC wrote: Tue Apr 10, 2018 1:47 pm
it's just that the information you were giving us was "fake news"
This seems slightly harsh given fake news is the deliberate attempt to fool the gullible/stupid.
You do realize it was humor, right?
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Mark RMBC »

You do realize it was humor, right?
I obviously should have added a smiley after my comment! :D
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Ashleigh W »

:) :thumbsup:
Post Reply