![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Deepest Level Topic Summary: How to get the deepest Level of a selected nod ? Created On: 1-Oct-2007 15:28 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Thanks it works fine. | |
![]() |
|
Hi all,
i´ve got a simple question. How to get the deepest level of a selected (current Object) Nod (child and child of child and so on) ? I think it will work with recursion, but i don´t really get it :-). Thanks for your help. |
|
![]() |
|
![]() |
|
Daniel,
No recursion necessary. The below should do the trick. ------------------------- Kevin Murphy http://www.baselinesinc.com The Requirements Management Experts |
|
![]() |
|
![]() |
|
Grrr.
That did not do the trick because of how the for object in object loop works. Sometimes I really cannot stand how DXL works. There is no reason why I shouldn't be able to loop through every child object with one loop. Try the attached code--this should work. It sets a filter for everything below the current object. Again, no recursion necessary. ------------------------- Kevin Murphy http://www.baselinesinc.com The Requirements Management Experts Edited: 1-Oct-2007 at 16:46 by Kevin Murphy |
|
![]() |
|
![]() |
|
Thanks it works fine.
|
|
![]() |
|
![]() |
|
Here is an alternate approach with no recursion and no filtering.
Edited: 3-Oct-2007 at 12:37 by ron lewis |
|
![]() |
|
![]() |
|
Yes, the "for o in o" loop finds only the immediate children and not the grand-children. Yes, that loop can be the basis for a recursive function.
The 'next(o)' only gets the next object in the current display. If filtering or leveling or something else is going on then you won't find all the objects. Imagine the results if sorting is currently on. Also, your solution finds the level of the deepest grand-child object; perhaps the original level should be subtracted to find out how 'deep' that grand-child is. Recursion is the answer. Other than that, use the 'for o in entire mod' loop, wait until you come to the Original object, then use your algorithm to calculate the deepest grand-child of that original object. That loop ignores all display issues (sorting, filtering etc) and returns objects in their natural paragraph order. - Louie |
|
![]() |
|
![]() |
|
Why does nobody like recursion ?
------------------------- E. Piallat CeBeNetwork Edited: 13-Oct-2007 at 19:45 by Eric Piallat |
|
![]() |
|
![]() |
|
There is a small typo in that code, the recursive call to deepest should have o as the parameter, not po.
------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Deepest Level
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.