Page 1 of 1

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

Posted: Mon Oct 05, 2009 2:40 pm
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...

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

Posted: Mon Oct 05, 2009 8:31 pm
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

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

Posted: Tue Oct 06, 2009 5:17 pm
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.

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

Posted: Tue Oct 06, 2009 6:46 pm
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

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

Posted: Tue Oct 06, 2009 10:37 pm
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.

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

Posted: Tue Oct 06, 2009 11:23 pm
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