Page 1 of 1

Copy part of a Dimension

Posted: Thu Dec 01, 2011 9:03 am
by ADW
Hi,

Does anyone know of an easy way to copy part of a dimension to another dimension through TI?

Example being the below. The dimension has multiple alternate hierarchies and I want to create a new dimension made up of just C and its children.

A
--1
--2
--3
B
--1
--3
C
--1
--2
--3
(the numbers are children of the letters)

I have a TI that copies the whole thing but I am struggling to then remove the items I don't want. There may be an easier way?

Re: Copy part of a Dimension

Posted: Thu Dec 01, 2011 9:17 am
by Alan Kirk
ADW wrote: Does anyone know of an easy way to copy part of a dimension to another dimension through TI?

Example being the below. The dimension has multiple alternate hierarchies and I want to create a new dimension made up of just C and its children.

A
--1
--2
--3
B
--1
--3
C
--1
--2
--3
(the numbers are children of the letters)

I have a TI that copies the whole thing but I am struggling to then remove the items I don't want. There may be an easier way?
Use an If block so that the copy is only done if the element is C, or the element passes an ElIspar test where the parent element is C.

If there are intermediate consolidations to be copied between C and the N level elements, use the ElIsAnc function instead of ElIspar.

Skip any elements which don't pass the relevant test.

Be sure that your source is in hierarchy order so that you'll be adding the top level consolidations first, which will then allow you to add the children below that.

Re: Copy part of a Dimension

Posted: Thu Dec 01, 2011 9:18 am
by David Usherwood

Code: Select all

if(elisanc('dim','C',elem) = 1);
<add to new dim>
endif;
You'll probably want to add C itself as well.

Re: Copy part of a Dimension

Posted: Thu Dec 01, 2011 9:21 am
by Alan Kirk
David Usherwood wrote:

Code: Select all

if(elisanc('dim','C',elem) = 1);
<add to new dim>
endif;
You'll probably want to add C itself as well.
Beat you by 1 minute. :D

Re: Copy part of a Dimension

Posted: Thu Dec 01, 2011 9:54 am
by lotsaram
Have you looked at the bedrock TI code base? There a a few pre-built processes there that could probably do the job.

Re: Copy part of a Dimension

Posted: Thu Dec 01, 2011 10:06 am
by ADW
Thanks for all your replies. I have seen the bedrock site and used some of the code on there. Makes things a lot easier as I get something that works and can then pick it a apart to understand how, rather than sitting here scratching my head.

The elisanc is exactly what I was looking for.

Cheers!

Re: Copy part of a Dimension

Posted: Fri Dec 02, 2011 8:30 am
by ADW
Just as a follow up to this for those who may be interested. To get the top level ('C' in the example) I had to put an or (%) in my formula as below.

Code: Select all

If( elisanc( pSourceDim, pAncestor, vElement) = 1 % vElement @= pAncestor) ;

Re: Copy part of a Dimension

Posted: Mon Jan 16, 2012 1:18 pm
by pradeep.k.jagadeesan
Can you post the entire coding for this. I am in need for that. Please.

Thanks in advance.

Regards
Pradeep J

Re: Copy part of a Dimension

Posted: Mon Jan 16, 2012 9:46 pm
by Martin Ryan
"Entire coding" is at bedrocktm1.org

Martin

Re: Copy part of a Dimension

Posted: Tue Jan 17, 2012 10:38 am
by pradeep.k.jagadeesan
I have checked in BedRock TM1. But unable to find the relevent TI process. Can anybody help me to find the appropriate logic?

Thanks in advance
Regards
Pradeep J

Re: Copy part of a Dimension

Posted: Tue Jan 17, 2012 10:52 am
by lotsaram
pradeep.k.jagadeesan wrote:I have checked in BedRock TM1. But unable to find the relevent TI process. Can anybody help me to find the appropriate logic?

Thanks in advance
Regards
Pradeep J
You haven't stipulated what your logic would be to determine how to define the "part" of the dimension which you want to copy. Is it for example
- all descendants from a given consolidation?
- all elements with a given attribute value?
- all elements of a certain level?
- all elements with names starting with a given string?

Assuming it is the first then Bedrock.Dim.Sub.Create.FromConsol.AllElements will contain the logic you need (a simple ElIsAnc test) and you will just need to modify to create a new dimension and copy in the parent child relationships as well as just the element names. The logic for that step you can get from Bedrock.Dim.Clone