Reordering Elements

Post Reply
par3
Posts: 82
Joined: Tue Sep 09, 2008 7:05 am

Reordering Elements

Post by par3 »

Hi Guys,

I know this is probably not that hard to do but I just can't think of a way to do it right now. I have a few "loose" elements in a dimension that needs to be ordered under a parent. I can't do it manually because it would take me forever because there are two many of them. I have tried using TI and updating the dimension using the source file of the dimension but that did not cut it.

Any help please?
ScottW
Regular Participant
Posts: 152
Joined: Fri May 23, 2008 12:08 am
OLAP Product: TM1 CX
Version: 9.5 9.4.1 9.1.4 9.0 8.4
Excel Version: 2003 2007
Location: Melbourne, Australia
Contact:

Re: Reordering Elements

Post by ScottW »

Do you mean just placing new elements under the correct parents or is the actual order of the elements under the parents important?

If it's the former then this is easy with TI, if it's the later then not so. Unless you are dealing with a time dimension I would argue that index order is not important as presentation in views and reports can be precisely controlled with subsets, if you are dealing with a time dimension then I would argue that manual dimension maintenance is the way to go specifically to control index order. You only have 3 options for ordering components of consolidations i) the order in which they were added ii) by alpha numeric sort order or iii) manual order (to use the 3rd option manual sort order must be selected for the dimension and you will have to do the ordering in dimension editor or XDI).

If you do just want to add elements to a consolidation this is usually achieved with a "move" process. Typically an attribute exists that has the purpose of holding a string value equal to its roll up parent. You then process the elements you want to with a subset source and use the attribute value as an argument for a DimensionElementComponentAdd. This is quite straightforward TI and quite easy to make the process generic with parameters so that it will work for any given dimension/subset combination.

Always be very careful about mixing dimension maintenance. Either maintain with TI or maintain manually, don't try to do both.
Cheers,
Scott W
Cubewise
www.cubewise.com
par3
Posts: 82
Joined: Tue Sep 09, 2008 7:05 am

Re: Reordering Elements

Post by par3 »

Not the order or the index is important. It is existing elements in the dimension which I just need to move under the correct parent. There are however to many of these elements to do it manually.
ScottW
Regular Participant
Posts: 152
Joined: Fri May 23, 2008 12:08 am
OLAP Product: TM1 CX
Version: 9.5 9.4.1 9.1.4 9.0 8.4
Excel Version: 2003 2007
Location: Melbourne, Australia
Contact:

Re: Reordering Elements

Post by ScottW »

OK, I'm going to presume that your new elements are either orphans or are sitting under a "New Elements" hierarchy.

In either case it is pretty easy to write either a TI or MDX to create a subset to scoop up these elements into a list for processing.
Next create an attribute in the dimension, call it "RollupParent" or something similar and assign a string value for each of your new elements equal to the consolidated element you want to roll up into.
Then write a TI to process the new elements subset.

Code on the meta data tab will be simply
sParent = AttrS(cDim, vEle, 'RollupParent');
DimensionElementComponentAdd(cDim, sParent, vEle, 1);

... plus presumably a DimensionElementComponentDelete to remove the element from your "New Elements" consol (if you have one, ... I would suggest that you should have if you currently don't.)
Cheers,
Scott W
Cubewise
www.cubewise.com
Post Reply