I'm trying to create a subset containing only level 0 elements from a consolidation in a TI process using the following code:
Code: Select all
## Build branch subset ##
vString = 'Trading Branches';
Dim = 'Branch';
If (SubsetExists(Dim,vPrefix)=1);
SubsetDeleteAllElements(Dim,vPrefix);
Else;
SubsetCreate(Dim,vPrefix);
Endif;
vCounter =1;
vNumberOfComponents = ELCOMPN(Dim, vString);
WHILE (vCounter <= vNumberOfComponents);
IF (ELLEV (Dim, ELCOMP(Dim,vString, vCounter)) = 0);
SubsetElementInsert(Dim, vPrefix, ELCOMP(Dim,vString, vCounter),1);
ENDIF;
vCounter= vCounter +1;
END;
What am I missing here? I expected the combination of ELLEV and ELCOMP to go through all items in the subset hierarchy tree, but it only seems to do one level? If that's just how it works how best would I get what I'm after?