carry forward a dimension elements to another dimension

Post Reply
Analytics123
Posts: 86
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

carry forward a dimension elements to another dimension

Post by Analytics123 » Wed Dec 06, 2017 1:21 am

Hi,

I have a dimension say A having certain elements with unbalanced hierarchy.

Now I have a dimension b similar to A with unbalanced hierarchy. Now my requirement is to iterate all elements with in dimension B and add them below dimension A .

SO bascically i will have to take elements in dimnesion b and copy over along with dimension A elements daily.

How do I automate this process. Copy elements from Dimension B and add it to dimension A .

ascheevel
Posts: 16
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: 11.2
Excel Version: 2016

Re: carry forward a dimension elements to another dimension

Post by ascheevel » Wed Dec 06, 2017 9:41 am

Dimension A is an exact copy of Dimension B, why not use only one dimension? If you must use two dims, you can use a WHILE loop in the prolog or epilog tab of a TI process to spin through all elements in Dimension B and add to Dimension A. Below is sample code for looping through all elements of Dimension B and adding each to Dimension A. You would need additional code if you want to copy the parent/child relationships to Dimension A. You've a couple options for doing that, one would be to evaluate all parents of the element being evaluated, make sure the parent exists in Dimension A, and then add the parent/child relationship. I bet there's other posts in the forum explaining how to that as well as other options for copying parent/child relationships from one dim to another.

Code: Select all

# not debugged, so errors likely present
vDim1 = 'Dimension B';
vDim2 = 'Dimension A';
vLimit = DIMSIZ(vDim1);
index1 = 1;

WHILE(index1 <= vLimit);
	vElement = DIMNM(vDim1, index1);
	vType = DTYPE(vDim1, vElement);
	DimensionElementInsert(vDim2, '', vElement, vType);
	index1 = index1 + 1;
END;

Analytics123
Posts: 86
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

Re: carry forward a dimension elements to another dimension

Post by Analytics123 » Wed Dec 06, 2017 1:40 pm

Its not an exact copy , its like appending dimension B to dimension A. DImension B might change some times , so the append process to unwind dimension b elements added to dimension A and readd them daily .

User avatar
Elessar
Posts: 103
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: carry forward a dimension elements to another dimension

Post by Elessar » Wed Dec 06, 2017 2:18 pm

If you understand you right, bedrock.dim.clone with pUnwind=2 will solve your task:
https://github.com/cubewise-code/bedroc ... .Clone.pro
Sorry for my English ;)

Analytics123
Posts: 86
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

Re: carry forward a dimension elements to another dimension

Post by Analytics123 » Mon Dec 11, 2017 1:58 am

hi,

I am adding to dimension A , but I am just appending dimension b to dimension A. But dimension B can change any time and that needs to be reflected on DImension A on daily basis.

So I have to unwind Dim B elements in Dim A daily and then readd dim B elements to dim A .

so to append Dim B to Dim A.

I need a ti that will loop through all the elements of dim b and append it to dim A .

But how do i maintain/bring in the parent child relationship of dim B while appending.

Thanks,

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

Re: carry forward a dimension elements to another dimension

Post by Wim Gielis » Mon Dec 11, 2017 7:06 pm

Analytics123 wrote:
Mon Dec 11, 2017 1:58 am
hi,

I am adding to dimension A , but I am just appending dimension b to dimension A. But dimension B can change any time and that needs to be reflected on DImension A on daily basis.

So I have to unwind Dim B elements in Dim A daily and then readd dim B elements to dim A .

so to append Dim B to Dim A.

I need a ti that will loop through all the elements of dim b and append it to dim A .

But how do i maintain/bring in the parent child relationship of dim B while appending.

Thanks,
Using the functions ElparN and Elpar you can loop over all parents of an element.
That way, you can DimensionElementComponentAdd an element to its parent(s) in the other dimension.
Best regards,

Wim Gielis

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 104 TM1 articles and a lot of custom code
Newest blog article: Delete a cube and its dimensions

Post Reply