Page 1 of 1
Getting level 0 element
Posted: Tue Jan 17, 2012 11:19 pm
by winsonlee
Grand Parent 1
-- Parent 2
--- Child 3
--- Child 4
--- Child 5
-- Parent 7
-- Parent 8
How can i create a while loop that when i specify Grand parent 1 element, it will return all the level 0 element which is Child 3, 4 , 5 , Parent 7 an 8? or when i specify Parent 2, it will return Child 3,4 and 5.
Re: Getting level 0 element
Posted: Tue Jan 17, 2012 11:34 pm
by Gregor Koch
Hi
A 'while loop' in Turbo Integrator? How many levels are in the hierarchy?
Have you considered the ELISANC function?
Re: Getting level 0 element
Posted: Tue Jan 17, 2012 11:37 pm
by Alan Kirk
winsonlee wrote:Grand Parent 1
-- Parent 2
--- Child 3
--- Child 4
--- Child 5
-- Parent 7
-- Parent 8
How can i create a while loop that when i specify Grand parent 1 element, it will return all the level 0 element which is Child 3, 4 , 5 , Parent 7 an 8? or when i specify Parent 2, it will return Child 3,4 and 5.
Can you please clarify your question? In the title you're talking about "Getting Level 0 element". In the body of it you're saying that you want consolidations (which are not level 0 elements) returned as well ("Parent 7 an 8"). Which is it? The answer will be quite different depending on what your real intention is.
However in either case, you may want to look at the ElComp, ElCompN and ElIsAnc functions to see whether they point you in the right direction.
Re: Getting level 0 element
Posted: Tue Jan 17, 2012 11:44 pm
by winsonlee
thanks for the tips..
got it working ...
[code1]
i = DIMSIZ(DimOrder) ;
WHILE( i > 0) ;
vElem =DimNM (DimOrder, i);
vLevel = Ellev (DimOrder, vElem);
vParent = ELISANC(DimOrder, Customer, vElem);
IF (vParent = 1 & vLevel = 0);
SubsetElementInsert(DimOrder, subOrder, vElem,1);
ENDIF;
i = i -1 ;
END;
[/code]
Re: Getting level 0 element
Posted: Tue Jan 17, 2012 11:46 pm
by winsonlee
parent 7 & 8 does not have any element under them, so it is still consider as Level 0 element.