Just wondering. If we need to loop over all elements in a dimension (classical definition of a dimension),
is this the way forward ? Seems like overkill if you ask me.
Only to get the number of elements in a dimension we need to loop over all hierarchies and test if the element is new w.r.t. previous hierarchies ?
Should all our dimension manipulations and stuff be generalized to the n-hierarchy case ?
Code: Select all
# the number of elements in a dimension (classical definition)
# example from the Smartco TM1 server
# Wim Gielis - 2018-03-07
# loop over hierarchies
h = 1;
While( h <= DIMSIZ( '}Hierarchies_organization' ) );
vHierarchy = Dimnm( '}Hierarchies_organization', h );
# loop over elements
i = 1;
While( i <= DIMSIZ( vHierarchy ));
vElem = Dimnm( vhierarchy, i );
bFound = 0;
# loop over hierarchies again
hh = 1;
While( hh < h );
vHierarchy_check = Dimnm( '}Hierarchies_organization', hh );
If( Dimix( vHierarchy_check, vElem ) > 0 );
bFound = 1;
break;
EndIf;
hh = hh + 1;
End;
If( bFound = 0 );
ASCIIOutput( 'test.txt', NumberToString( i ), vHierarchy, vElem );
EndIf;
i = i + 1;
End;
h = h + 1;
End;
Wim