Getting all the children of an element
Posted: Tue May 28, 2019 10:27 pm
Hi, In a TI, I want to loop through all the child elements of an element passed as an argument.
For eg if Element name argument to TI is 'Element 1' , TI should iterate through
Element 1.1
Element 1.2
Element 1.3
Element 1.3.1
Element 1.3.2
I tried ElementCount function, but it is throwing error as 'variable ElementCount is UNDEFINED' !!!
I tried getting count using ELCOMPN but it returns 3 for 'Element 1' (instead of 5 that I need) and I want to loop through all the children under Element 1.
If I pass 'Element B' as an argument then it should return only 'Element B' since it does not have any child element.
Logic that I thought of ..
----------------------------------------------
IF Element consolidated
Get the Count of all the children (say iAllChild)
While iCounter < iAllChild
loop thorugh all the Children using the Index
End
else
return same element
endif
----------------------------------------------
Please advise how to accomplish above or if there is a better way.
Thanks,
Rtel
--------------------------------------------------------------------
Sample Dimension
Element A
Element 1
Element 1.1
Element 1.2
Element 1.3
Element 1.3.1
Element 1.3.2
Element 2
Element B
Element C
For eg if Element name argument to TI is 'Element 1' , TI should iterate through
Element 1.1
Element 1.2
Element 1.3
Element 1.3.1
Element 1.3.2
I tried ElementCount function, but it is throwing error as 'variable ElementCount is UNDEFINED' !!!
I tried getting count using ELCOMPN but it returns 3 for 'Element 1' (instead of 5 that I need) and I want to loop through all the children under Element 1.
If I pass 'Element B' as an argument then it should return only 'Element B' since it does not have any child element.
Logic that I thought of ..
----------------------------------------------
IF Element consolidated
Get the Count of all the children (say iAllChild)
While iCounter < iAllChild
loop thorugh all the Children using the Index
End
else
return same element
endif
----------------------------------------------
Please advise how to accomplish above or if there is a better way.
Thanks,
Rtel
--------------------------------------------------------------------
Sample Dimension
Element A
Element 1
Element 1.1
Element 1.2
Element 1.3
Element 1.3.1
Element 1.3.2
Element 2
Element B
Element C