Page 1 of 1

DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 10:50 am
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

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 10:52 am
by gtonkin
Check your dimension sort order. Try set to Hierarchy, by Name if not set already.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 10:58 am
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

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 11:02 am
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.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 11:04 am
by tomok
It's in the }DimensionProperties cube but you can also set it via TI. Please consult the TI functions help.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

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

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 11:27 am
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?

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 11:34 am
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);

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 11:44 am
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.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 12:03 pm
by Ashleigh W
ok. Thanks for your help!

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 12:18 pm
by Ashleigh W
Do I need to execute this code from MetaData tab or Prolog itself is fine?

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 12:39 pm
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.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 1:24 pm
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.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 1:47 pm
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.

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Tue Apr 10, 2018 4:48 pm
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?

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Wed Apr 11, 2018 9:21 am
by Mark RMBC
You do realize it was humor, right?
I obviously should have added a smiley after my comment! :D

Re: DIMENSIONELEMENTCOMPONENTADD - Not working as expected - Please advise

Posted: Fri Jul 13, 2018 11:47 am
by Ashleigh W
:) :thumbsup: