Copy part of a Dimension

Post Reply
User avatar
ADW
Posts: 32
Joined: Tue Jun 14, 2011 11:10 am
OLAP Product: Cognos Express
Version: 9.5
Excel Version: 2010
Location: Cheshire, England

Copy part of a Dimension

Post 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?
Alan Kirk
Site Admin
Posts: 6645
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Copy part of a Dimension

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Copy part of a Dimension

Post 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.
Alan Kirk
Site Admin
Posts: 6645
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Copy part of a Dimension

Post 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
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
lotsaram
MVP
Posts: 3698
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Copy part of a Dimension

Post 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.
User avatar
ADW
Posts: 32
Joined: Tue Jun 14, 2011 11:10 am
OLAP Product: Cognos Express
Version: 9.5
Excel Version: 2010
Location: Cheshire, England

Re: Copy part of a Dimension

Post 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!
User avatar
ADW
Posts: 32
Joined: Tue Jun 14, 2011 11:10 am
OLAP Product: Cognos Express
Version: 9.5
Excel Version: 2010
Location: Cheshire, England

Re: Copy part of a Dimension

Post 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) ;
pradeep.k.jagadeesan
Posts: 28
Joined: Tue Jun 16, 2009 1:03 pm
OLAP Product: IBM Cognos TM1
Version: 9.5.1
Excel Version: 2007
Location: India

Re: Copy part of a Dimension

Post 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
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Copy part of a Dimension

Post by Martin Ryan »

"Entire coding" is at bedrocktm1.org

Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
pradeep.k.jagadeesan
Posts: 28
Joined: Tue Jun 16, 2009 1:03 pm
OLAP Product: IBM Cognos TM1
Version: 9.5.1
Excel Version: 2007
Location: India

Re: Copy part of a Dimension

Post 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
lotsaram
MVP
Posts: 3698
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Copy part of a Dimension

Post 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
Post Reply