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.
Getting level 0 element
-
- MVP
- Posts: 263
- Joined: Fri Jun 27, 2008 12:15 am
- OLAP Product: Cognos TM1, CX
- Version: 9.0 and up
- Excel Version: 2007 and up
Re: Getting level 0 element
Hi
A 'while loop' in Turbo Integrator? How many levels are in the hierarchy?
Have you considered the ELISANC function?
A 'while loop' in Turbo Integrator? How many levels are in the hierarchy?
Have you considered the ELISANC function?
- Alan Kirk
- Site Admin
- Posts: 6610
- Joined: Sun May 11, 2008 2:30 am
- OLAP Product: TM1
- Version: PA2.0.9.18 Classic NO PAW!
- Excel Version: 2013 and Office 365
- Location: Sydney, Australia
- Contact:
Re: Getting level 0 element
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.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.
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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- Regular Participant
- Posts: 180
- Joined: Thu Jul 01, 2010 3:06 am
- OLAP Product: Cognos Express
- Version: 9.5
- Excel Version: 2007
- Location: Melbourne, Australia
Re: Getting level 0 element
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]
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]
-
- Regular Participant
- Posts: 180
- Joined: Thu Jul 01, 2010 3:06 am
- OLAP Product: Cognos Express
- Version: 9.5
- Excel Version: 2007
- Location: Melbourne, Australia
Re: Getting level 0 element
parent 7 & 8 does not have any element under them, so it is still consider as Level 0 element.