Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Daniel Kübert, on Tuesday, October 2, 2007 4:10 PM

Answer:
Thanks it works fine.
 1-Oct-2007 15:28
User is offline View Users Profile Print this message


Daniel Kübert

Posts: 10
Joined: 27-Sep-2007

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.
 
Report this to a Moderator Report this to a Moderator
 1-Oct-2007 16:35
User is offline View Users Profile Print this message


Kevin Murphy

Posts: 206
Joined: 15-Jul-2005

Daniel,

No recursion necessary. The below should do the trick.

-------------------------
Kevin Murphy
http://www.baselinesinc.com
The Requirements Management Experts
Report this to a Moderator Report this to a Moderator
 1-Oct-2007 16:43
User is offline View Users Profile Print this message


Kevin Murphy

Posts: 206
Joined: 15-Jul-2005

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
Report this to a Moderator Report this to a Moderator
 2-Oct-2007 16:10
User is offline View Users Profile Print this message


Daniel Kübert

Posts: 10
Joined: 27-Sep-2007

Answer Answer
Thanks it works fine.
Report this to a Moderator Report this to a Moderator
 2-Oct-2007 21:59
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Here is an alternate approach with no recursion and no filtering.

Edited: 3-Oct-2007 at 12:37 by ron lewis
Report this to a Moderator Report this to a Moderator
 8-Oct-2007 22:45
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 13-Oct-2007 19:22
User is offline View Users Profile Print this message


Eric Piallat

Posts: 33
Joined: 26-Jan-2004

Why does nobody like recursion ?



-------------------------
E. Piallat
CeBeNetwork

Edited: 13-Oct-2007 at 19:45 by Eric Piallat
Report this to a Moderator Report this to a Moderator
 15-Oct-2007 13:28
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.