Hi
I have an alternative dimension hierachy that is to be destroyed and rebuilt every night (rebuilt based on CSV file). Only C levels to be rebuilt (N elements not to be touched to preserve data). I can figure out how to build this however I can not find an easy way to destroy a particular hierachy and all its C element children. (given I dont know the children names)
"DIMENSIONELEMENTDELETE" works but as I do not know the names of the children I cannot hardcode it. I have considered dynamic MDX subsets but figure this will not work as the subset would change each time I delete a C element child.
Can anyone help with how I can destroy all consolidaion levels under a parent in a dimension.
TI process to delete all C elements in a particular hierachy
-
- Posts: 48
- Joined: Thu Nov 19, 2009 10:38 pm
- OLAP Product: Tm1
- Version: 10.2.2
- Excel Version: 2010
Re: TI process to delete all C elements in a particular hier
The following. If you want to be more specific about which hierarchy you want to unwind/rebuild (say if you had several hierarchies) you will need to put a flag as an attribute against the hierarchy/consolidation elements you want unwind and add a test for this flag in the following script..
DimName = 'yourDimName';
DimCount = DimSiz ( DimName );
i = 1;
While ( i <= DimCount ) ;
DimCount = DimSiz (DimName);
El = DimNm ( DimName , i);
ChildCount = ElCompN(DimName, El) ;
If ( ChildCount <> 0);
y = 1;
While ( y <= ChildCount );
ChildEl = ElComp ( DimName , El, 1);
DimensionElementComponentDelete(DimName, El, ChildEl);
y = y +1 ;
End ;
EndIf ;
i = i + 1 ;
End;
DimName = 'yourDimName';
DimCount = DimSiz ( DimName );
i = 1;
While ( i <= DimCount ) ;
DimCount = DimSiz (DimName);
El = DimNm ( DimName , i);
ChildCount = ElCompN(DimName, El) ;
If ( ChildCount <> 0);
y = 1;
While ( y <= ChildCount );
ChildEl = ElComp ( DimName , El, 1);
DimensionElementComponentDelete(DimName, El, ChildEl);
y = y +1 ;
End ;
EndIf ;
i = i + 1 ;
End;
J.Rizk
Tm1 for everyone
Tm1 for everyone
-
- Posts: 33
- Joined: Fri Jul 09, 2010 12:12 am
- OLAP Product: tm1
- Version: TM1 Build Number: 11.8.01300.
- Excel Version: Version 2401
Re: TI process to delete all C elements in a particular hier
Thanks Jrizk
Your idea to build the alternative (second) hierachy C elements with a flag identifying it later needs deletion was invaluable. (my original approach missed this)
Regards
JD
Your idea to build the alternative (second) hierachy C elements with a flag identifying it later needs deletion was invaluable. (my original approach missed this)
Regards
JD