DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post Reply
Ashleigh W
Posts: 62
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 » Tue Apr 10, 2018 10:50 am

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: 638
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: PAL 2.0.3
Excel Version: 2016 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin » Tue Apr 10, 2018 10:52 am

Check your dimension sort order. Try set to Hierarchy, by Name if not set already.

Ashleigh W
Posts: 62
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 » Tue Apr 10, 2018 10:58 am

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: 638
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: PAL 2.0.3
Excel Version: 2016 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin » Tue Apr 10, 2018 11:02 am

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.

User avatar
tomok
MVP
Posts: 2494
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 » Tue Apr 10, 2018 11:04 am

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: 62
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 » Tue Apr 10, 2018 11:24 am

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: 638
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: PAL 2.0.3
Excel Version: 2016 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin » Tue Apr 10, 2018 11:27 am

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: 62
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 » Tue Apr 10, 2018 11:34 am

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: 638
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: PAL 2.0.3
Excel Version: 2016 64-bit
Location: JHB, South Africa
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by gtonkin » Tue Apr 10, 2018 11:44 am

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: 62
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 » Tue Apr 10, 2018 12:03 pm

ok. Thanks for your help!

Ashleigh W
Posts: 62
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 » Tue Apr 10, 2018 12:18 pm

Do I need to execute this code from MetaData tab or Prolog itself is fine?

Wim Gielis
MVP
Posts: 1826
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0
Excel Version: 2016
Location: Brussels, Belgium
Contact:

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Post by Wim Gielis » Tue Apr 10, 2018 12:39 pm

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

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 105 TM1 articles and a lot of custom code
Newest blog article: Looping over input files

User avatar
tomok
MVP
Posts: 2494
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 » Tue Apr 10, 2018 1:24 pm

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
Regular Participant
Posts: 163
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 » 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.

User avatar
tomok
MVP
Posts: 2494
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 » Tue Apr 10, 2018 4:48 pm

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
Regular Participant
Posts: 163
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 » Wed Apr 11, 2018 9:21 am

You do realize it was humor, right?
I obviously should have added a smiley after my comment! :D

Ashleigh W
Posts: 62
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 » Fri Jul 13, 2018 11:47 am

:) :thumbsup:

Post Reply