Subassy

i am struggling to get component at first level.

i have structure

Dwg
-Assy
-comp1
-comp2
-comp3
-subcomp1
-subsubcomp1
-subcomp2
-subcomp3
-comp4

through the associativity ia m able to get component, i need component at first level. suppose dimension is associated to subsubcomp1 i need comp3 as output & if it is comp2 then output will be comp2
I am struggling with recursuve here.
Thanks

What is your goal and workflow? It sounds like you have a dimension object and want to know what components it is associated to? Or are you doing something else? What are your inputs and desired output?

Assy is my first level child component,comp1,comp2,comp3,comp4 are second level child component, subcomp1 child of comp1,subsubcomp1 child of subcomp1.

i am getting the component from whatever user pick from drafting views.
I want to pull attribute value of component(which is picked). If first level
component eg: comp1 comp2 is picked thats fine. But if i get component as subsubcomp1 i have to traverse to second level child component hence in this case it will be comp3

It is solved. THANKS