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: Count objects in view
Topic Summary: Without using the filter window....
Created On: 14-Aug-2007 14:04
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 Peter Albert, on Wednesday, August 15, 2007 3:02 PM

Answer:
The "for object in ... module" loops offer different options; the plain "for object in module" respects filters, therefore the following lines will print the number of objects visible in the current view:

Object o
int n = 0
for o in current Module do {n++}
print n " objects in current view"

As for the attribute DXL, something like

Object o
int n = 0
for o in current Module do
{
n++
if (o == obj){obj.attrDXLName = n ""}
}


does the trick, but I doubt it is very clever, as the loop over the module for each object for sure is quite time consuming. I guess it is better to combine the above script with an assignment to an attribute, if you really need the information in an attribute.

Regards,

Peter
 14-Aug-2007 14:04
User is offline View Users Profile Print this message


Corey Carroll

Posts: 48
Joined: 25-May-2006

Is there some way to count the number of objects in a view without using the filter window?  Is there a DXL that can be placed in an attribute that will sequentially assign a number to each object in a view?  Thanks, Corey.
Report this to a Moderator Report this to a Moderator
 14-Aug-2007 14:13
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Answer Answer
The "for object in ... module" loops offer different options; the plain "for object in module" respects filters, therefore the following lines will print the number of objects visible in the current view:

Object o
int n = 0
for o in current Module do {n++}
print n " objects in current view"

As for the attribute DXL, something like

Object o
int n = 0
for o in current Module do
{
n++
if (o == obj){obj.attrDXLName = n ""}
}


does the trick, but I doubt it is very clever, as the loop over the module for each object for sure is quite time consuming. I guess it is better to combine the above script with an assignment to an attribute, if you really need the information in an attribute.

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 15-Aug-2007 15:03
User is offline View Users Profile Print this message


Corey Carroll

Posts: 48
Joined: 25-May-2006

Thanks, Peter!  The attribute DXL did the trick!
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.