Page 1 of 1
Hierarchy Updates / Mgmt
Posted: Sun Dec 13, 2009 9:00 pm
by image2x
Could anyone share or point me to some TI examples for managing hierarchy updates?
My hierarchy import file is in the format of:
Child Parent Weight ChildAlias
I imagine the logic is something like this:
(1) if child or parent doesn't exist, create and associate
(2) if they exist, but aren't currently child/parent or if aliases have changed, update association/aliases
(3) remove instances no longer in hierarchy (would need to control which subset is subject to the "clean-up" so that alternative rollups/metrics are not removed)
Thanks,
-- John
Re: Hierarchy Updates / Mgmt
Posted: Mon Dec 14, 2009 10:42 am
by jim wood
We do it in 2 steps. Firstly we remove any current relationship for any child level item in the file (To avoid duplication) and then we re-run it through to then re-establish child - parent relationships and ad any new children. We do it this way so we don't loose any data associated with elements that are no longer in the file. For us this either means product or outlets. Our underlying systems only keep product / outlets for the current season,
Jim.
Removing Current Relationships All in MetaData Tab:
Code: Select all
V11=ELPAR('taps sandbox leaf',V7,1);
DimensionElementComponentDelete('taps sandbox leaf',V11,V7);
Re-Adding them back in:
Prolog:
Code: Select all
DIMENSIONSORTORDER('taps sandbox leaf','ByInput','ASCENDING','ByHierarchy','ASCENDING');
ATTRDELETE('taps sandbox leaf','Description');
ATTRINSERT('taps sandbox leaf','','Description','A');
MetaData:
Code: Select all
V10='All Products';
V11=if(V2@='FOOTWEAR & ACCESSORIES','Footwear',if(V2@='LADIES BRANDS & ESSENTIALS','Ladieswear',if(V2@='LADIES MAINSTREAM','Ladieswear',if(V2@='LADIES
FASHION','Ladieswear',V2))));
DIMENSIONELEMENTINSERT('taps sandbox leaf','',V7,'n');
DIMENSIONELEMENTINSERT('taps sandbox leaf','',V10,'c');
DIMENSIONELEMENTINSERT('taps sandbox leaf','',V11,'c');
DIMENSIONELEMENTCOMPONENTADD('taps sandbox leaf',V10,V2,1.000000);
DIMENSIONELEMENTCOMPONENTADD('taps sandbox leaf',V11,V7,1.000000);
Re: Hierarchy Updates / Mgmt
Posted: Tue Dec 15, 2009 4:08 am
by image2x
Jim, thank you for sharing. I'm sure I'll be able to leverage your code.
I'll have to add in a way to preserve attributes on consolidated/leaf members that aren't part of the dimension load probably by creating a backup of the dimension first, running your steps, and the reestablishing the attributes.
I'll post my code when complete.