How do I copy a Dimension with Attributes (Alias etc)

Post Reply
John Hammond
Community Contributor
Posts: 300
Joined: Mon Mar 23, 2009 10:50 am
OLAP Product: PAW/PAX 2.0.72 Perspectives
Version: TM1 Server 11.8.003
Excel Version: 365 and 2016
Location: South London

How do I copy a Dimension with Attributes (Alias etc)

Post by John Hammond »

Folks

I sure can't find an easy way to do this.

1. There is no right click and copy a dimension.
2. You can edit dimension structure and then save but attributes are not copied.
3. You can export dimension but attributes are not saved.
4. You can Edit Element Attributes but there is no way of saving them independent of the dimension.

I must be missing a trick - I usually am!

Any help on this appreciated...
User avatar
wissew
Posts: 54
Joined: Tue Jun 17, 2008 7:24 pm
OLAP Product: TM1
Version: 9.5.2; 10.2.2; 11
Excel Version: 2003 SP3 - 2013
Location: Beaverton, OR

Re: How do I copy a Dimension with Attributes (Alias etc)

Post by wissew »

John Hammond wrote:Folks

I sure can't find an easy way to do this.

1. There is no right click and copy a dimension.
2. You can edit dimension structure and then save but attributes are not copied.
3. You can export dimension but attributes are not saved.
4. You can Edit Element Attributes but there is no way of saving them independent of the dimension.

I must be missing a trick - I usually am!

Any help on this appreciated...
Turn on your control objects and creat a TI process that reads the attribute cube and creates you new dimension with the existing attributes and elements. Almost as easy as right click and copy
dymoy
Posts: 16
Joined: Mon Dec 08, 2008 8:36 pm

Re: How do I copy a Dimension with Attributes (Alias etc)

Post by dymoy »

The easiest way is just to save & shut down the TM1 server, locate the cubes and dimensions desired, and copy those objects with a different name. Then restart the server.
kpk
MVP
Posts: 214
Joined: Tue Nov 11, 2008 11:57 pm
OLAP Product: TM1, CX
Version: TM1 7x 8x 9x 10x CX 9.5 10.1
Excel Version: XP 2003 2007 2010
Location: Hungary

Re: How do I copy a Dimension with Attributes (Alias etc)

Post by kpk »

dymoy wrote:The easiest way is just to save & shut down the TM1 server, locate the cubes and dimensions desired, and copy those objects with a different name. Then restart the server.
Hello,

This trick works for copying cubes, rules or dimensions, but rarely for an attribute cube.
In an attribute cube there are 2 dimensions:
- "A": dimension which contains the business elements
- "B": dimension which contains the list of the attributes for dimension "A"
If you copy/save dimension A to dimension C then you usually need an attribute cube which has dimensions: C and (B or D).

Regards,

Peter
Best Regards,
Peter
lotsaram
MVP
Posts: 3703
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: How do I copy a Dimension with Attributes (Alias etc)

Post by lotsaram »

Hi dymoy, I wouldn't say this would rarely work. This will "work" but I would say categorically this will never work properly ...

Sure you can rename a .dim file file in file explorer while the server is down and when restarting you will have a renamed dimension and likewise sure you can rename a .cub file in file explorer while the server is down and when restarting you will have a renamed cube, but all the dimension pointers in the new cube will still be the same. What you cannot do is rename both the .cub AND .dim files of the component dimensions as this will invalidate all pointers in the cube and the cube will not load (if the originally named dimensions are no longer present on the server.) Therefore never rename any dimension that is used by cubes or pain will follow.

For this reason a simple renaming of an attributes cube to copy attributes to a renamed dimension will appear to work but in actual fact what you have is the renamed attributes cube still being composed of the original dimension and }ElementAttributes_dimension. If the replica dimension and/or attributes subsequently diverge from the original dimension or the original dimension is deleted then attributes in the new renamed dimension will be broken. For these reasons this is not an approach that I would ever advise or recommend.

The best approach to clone a dimension with all attributes is via TI as already advised. The coding to do this is not overly difficult.
Gregor Koch
MVP
Posts: 263
Joined: Fri Jun 27, 2008 12:15 am
OLAP Product: Cognos TM1, CX
Version: 9.0 and up
Excel Version: 2007 and up

Re: How do I copy a Dimension with Attributes (Alias etc)

Post by Gregor Koch »

Hi
Agree with lotsaram, TI is the way to go.
Just a little pointer, because you might stumble across problems with the element type in the }ElementAttributes dimension.
Not to take away the fun for the whole lot, here is a bit of code which will add the attributes to your new/renamed dimension ('cDimN') from your old ('cDimo').
Know that DTYPE returns 'AA', 'AS', 'AN' on an attribute dimension.

Code: Select all

### Creating Attribute Dim Elements

cDimA= '}ElementAttributes_' | cDimO;

DimensionCreate(cDimN);

iAttr = DIMSIZ(cDimA);

i=1;

WHILE (i <= iAttr);

vType= SUBST(DTYPE(cDimA, DIMNM(cDimA, i)),2,1); 

ATTRINSERT(cDimN, '', DIMNM(cDimA, i), vType);

i=i+1;

END;

### end attribute creation
Post Reply