Page 1 of 1
TI Change type of Level 0 element from C to N
Posted: Mon May 30, 2011 6:14 pm
by John Hammond
Is it possible to change an element type from C to N via TI other than by this method which seems quite cumbersome. (Of course it is easy in the Dimension Editor so you would expect something similar to be available in TI).
Record all Parentage of Element to temporary dimension.
Record all Attributes of Element to temporary dimension.
Record Index
Find Element_At_Index_plus_1
Delete Element
Readd Element with Type=N and use DimensionElementInsert InsertionPoint parameter to ensure it is prior to Element_At_Index_plus_1
Restore all Parentage
Restore all Attributes
Hope I am missing something here because it does seem to be using a sledge hammer to crack a nut.
TIA.
Regards
John
Re: TI Change type of Level 0 element from C to N
Posted: Mon May 30, 2011 6:31 pm
by tomok
Removing all the children underneath a parent element will convert it to an "N" element. Use a While..End loop to cycle through a "C" element and use the DimensionElementComponentDelete to remove each child.
Re: TI Change type of Level 0 element from C to N
Posted: Mon May 30, 2011 6:56 pm
by lotsaram
@John - if you also want to transfer data you will need to export that too. It is a bit of a sledgehammer but TM1 simply isn't set up for element renaming and N -> C or C -> N conversion. Of course if you're not concerned about the names exactly matching then you can do away with the temp dim (or text file) and just read straight in.
@Tomok - as far as I'm aware adding a child to an N will convert the N to a C. However deleting all children from a C will leave you with an orphan consolidation. The element will technically be level 0 but it will still have a DTYPE of C.
Re: TI Change type of Level 0 element from C to N
Posted: Mon May 30, 2011 8:23 pm
by Alan Kirk
lotsaram wrote:@John - if you also want to transfer data you will need to export that too. It is a bit of a sledgehammer but TM1 simply isn't set up for element renaming and N -> C or C -> N conversion. Of course if you're not concerned about the names exactly matching then you can do away with the temp dim (or text file) and just read straight in.
@Tomok - as far as I'm aware adding a child to an N will convert the N to a C. However deleting all children from a C will leave you with an orphan consolidation. The element will technically be level 0 but it will still have a DTYPE of C.
You're correct on the second point; removing the children doesn't work. More irritatingly if you have a subset which shows the consolidation with its original children, the (now non-existent) hierarchy will still appear. (Though when you select the consolidation element itself it will show that it has no children.) Also you still can't write to the element because it's a consolidation.
On the first point, I have to admit that I can't blame Applix for this one. Chances are that it wouldn't have even occurred to them that someone with a well designed metadata structure would need to do that conversion.
N to C does indeed happen automatically if you simply add children. The other way, you do have to destroy and recreate the element. However it's not necessary to temporarily store the attributes. If the change is done in the metadata tab of the process then it's done on a copy of the dimension which is only registered after the metadata tab ends. Consequently as long as both the destruction and recreation is done in the same tab, when the element comes out the other end the attributes cube thinks it's the same one and that the relevant metadata still applies.
Any calculated
data on the other hand... as you correctly indicate that would have to be exported and reimported because it was never stored anywhere.
(Edit: Same goes for storing the parents and reassigning it to them. A temporary dimension is as good a solution as any for that. Again this comes back to why this should even be necessary...)
Re: TI Change type of Level 0 element from C to N
Posted: Tue Jun 14, 2011 7:00 pm
by John Hammond
Sorry omitted to say thanks on this one to Tomok, Lotsa and Alan due to pressure of work and now I have a moment...Thanks
Its useful to know the attributes dont get deleted until you save a dimension which is kind of obvious since the attributes are stored in a cube which are only updated once you save the dimensionl.
In a spot of inspiration I tried to see whether reissuing a insertdimensionelement with a different type would work. it does not complain but does not do the change.
However you can use this method of reissuing the command with insertdimensioncomponent to change the weighting which is useful.