In most of the projects, data models have large dimension manually maintained, or directly in tm1 by dimension editor or passing through a linked database table. The correctness of hierarchies is fundamental for data quality: it’s enough an element is doubled in a hierarchy under the same root and your total figures are incorrect because the consolidation algorithm counts it twice! Checking large, multi-levelled dimension manually can be a time consuming task. I’d like to share my programmatic approach to the problem!
We can consider a dimension a collections of tree data structures, one tree for every root. Each node is an element, that can have zero (it’s a leaf) or more than zero (it’s a consolidation) children. We can apply depth-first search on each tree, and return error if there’s more than one path connecting a root with a leaf element.
We want to keep the code pure Turbo Integrator, without ExecuteJava extension keeping the code usable also in pre 10.2 TM1 versions. For TI technical limitation the recursive approach to the problem is not the best one, despite it’s the easiest to code, there is a limit of 100 recursive calls to a process and appending text to an existing file is tricky. Let’s go for iterative so.
The idea of the algorithm…
I hope you find this Blog post informative and of help to you in taking a new approach when working with Cognos TM1 Dimensions Code!