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: Filter on "Object Identifier"
Topic Summary:
Created On: 16-Apr-2003 04:34
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 Dennis Lockshine, on Thursday, April 17, 2003 5:50 AM

Answer:
The Object Identifier in DOORS is actually not an attribute -- it's two. It is made up of the Module's Prefix and each Object's Absolute Number attributes to make a single, unique entry.

Assuming the Module in question has a Prefix of "CP-HOPC.R.", the absolute number for your example is 60008 and you can modify your script so that the filter reads: a = attribute "Absolute Number" == 60008.

You can also use the built-in filter window to set "Absolute Number" is equal to 60008, but there's a better solution if you're not afraid to get into some dirty DXL.

Using the accept and reject commands on your Module, you can loop through your list of Objects to create a custom filter in one program.

Module m=current
Object o
Skip searchList=create
string id

// function to loop through Module and accept the proper Object
void acceptIdentifier(string id) {
for o in entire m do if(identifier o "" == id) {
accept o
break // to avoid comparing the entire Module if we find the Object
}
} // acceptIdentifier

// reject all Objects in the current Module
filtering off
for o in entire m do reject o

// read the list of Objects into a Skip list -- there are better ways of doing this
put(searchList, 1, "CP-HOPC.R.60008")
put(searchList, 2, "CP-HOPC.R.60009")
put(searchList, 3, "CP-HOPC.R.60010")

for id in searchList do acceptIdentifier(id)

delete searchList
filtering on
refresh m


This is fine and will work properly, but as Telelogic has told us time and again is that the use of string variables is a potential memory leak because the string table does not reuse entries, thus taking more and more system memory inside loops such as the one in the function above.

Another solution would be to use only the Absolute Number portion of the Object in question and modify the function above to accept an integer, but there's a much faster way to accomplish the same task. The difficult part is stripping out the integer portion from the list of Object Identifiers that was given to you. A simple Regexp can take care of that.

Module m=current
Object o
Skip objectList=create
Skip searchList=create
Regexp absoluteNumberMatch=regexp "([0-9]+$)"
string id
int absNo=0

// load the current Module into the Skip list
for o in entire m do {
absNo=o."Absolute Number"
put(objectList, absNo, o) // the key of the Skip list is the absolute number of the object
}

// reject all Objects in the current Module
filtering off
for o in entire m do reject o

// load the Object Identifiers into the searchList (same as before)
put(searchList, 1, "CP-HOPC.R.60008")
put(searchList, 2, "CP-HOPC.R.60009")
put(searchList, 3, "CP-HOPC.R.60010")

// loop through the searchList and create the filter.
// do this by getting the absolute number from the given Object Identifier using the Regexp, then
// perform a "find" operation on the objectList. if the result of the find is true, the variable o will be
// set to the Object in the Module.
for id in searchList do {
if(absoluteNumberMatch id) absNo=intOf(id[match 1]) else absNo=-1
if(find(objectList, absNo, o)) accept o
}

delete searchList
delete objectList
filtering on
refresh m


Although we still loop through the list and redefine the string id, it's not quite as bad because it only does this once, not multiple times for each Object Identifier in the Module every time you call the function to accept an Object for the filter.

You should note that when looping through the Module, I use the key word entire to grab each and every Object (including filtered, deleted, table headers, etc). This way we don't need to worry about the status of the current view when looping through the Module.

Happy coding!

-Dennis
 16-Apr-2003 04:34
User is offline View Users Profile Print this message


Pelp  

Posts: 11
Joined: 9-Apr-2003

Hi -

I was given a list of Objects in a module that I must look at. The module contains over 50,000 separate objects and all that was given me was the "Object Identifiers" of these objects.

Is it possible to filter on this attribute? I tired in the Filter box but it seems it's not possible and when I wrote a DXL script, DOORS gave me an error message.

The script was ...

--

Filter a;
a = attribute "Object Identifier" == "CP-HOPC.R.60008";
set (a);
filtering on;

--

... and the error message was ...

--

-R-E- DXL: <Line:3> unknown attribute (Object Identifier)
-I- DXL: <Line:5> execution halted

--

Just curious.
pelp

-------------------------
Report this to a Moderator Report this to a Moderator
 16-Apr-2003 13:49
User is offline View Users Profile Print this message


Dennis Lockshine

Posts: 113
Joined: 7-Apr-2003

Answer Answer
The Object Identifier in DOORS is actually not an attribute -- it's two. It is made up of the Module's Prefix and each Object's Absolute Number attributes to make a single, unique entry.

Assuming the Module in question has a Prefix of "CP-HOPC.R.", the absolute number for your example is 60008 and you can modify your script so that the filter reads: a = attribute "Absolute Number" == 60008.

You can also use the built-in filter window to set "Absolute Number" is equal to 60008, but there's a better solution if you're not afraid to get into some dirty DXL.

Using the accept and reject commands on your Module, you can loop through your list of Objects to create a custom filter in one program.

Module m=current
Object o
Skip searchList=create
string id

// function to loop through Module and accept the proper Object
void acceptIdentifier(string id) {
for o in entire m do if(identifier o "" == id) {
accept o
break // to avoid comparing the entire Module if we find the Object
}
} // acceptIdentifier

// reject all Objects in the current Module
filtering off
for o in entire m do reject o

// read the list of Objects into a Skip list -- there are better ways of doing this
put(searchList, 1, "CP-HOPC.R.60008")
put(searchList, 2, "CP-HOPC.R.60009")
put(searchList, 3, "CP-HOPC.R.60010")

for id in searchList do acceptIdentifier(id)

delete searchList
filtering on
refresh m


This is fine and will work properly, but as Telelogic has told us time and again is that the use of string variables is a potential memory leak because the string table does not reuse entries, thus taking more and more system memory inside loops such as the one in the function above.

Another solution would be to use only the Absolute Number portion of the Object in question and modify the function above to accept an integer, but there's a much faster way to accomplish the same task. The difficult part is stripping out the integer portion from the list of Object Identifiers that was given to you. A simple Regexp can take care of that.

Module m=current
Object o
Skip objectList=create
Skip searchList=create
Regexp absoluteNumberMatch=regexp "([0-9]+$)"
string id
int absNo=0

// load the current Module into the Skip list
for o in entire m do {
absNo=o."Absolute Number"
put(objectList, absNo, o) // the key of the Skip list is the absolute number of the object
}

// reject all Objects in the current Module
filtering off
for o in entire m do reject o

// load the Object Identifiers into the searchList (same as before)
put(searchList, 1, "CP-HOPC.R.60008")
put(searchList, 2, "CP-HOPC.R.60009")
put(searchList, 3, "CP-HOPC.R.60010")

// loop through the searchList and create the filter.
// do this by getting the absolute number from the given Object Identifier using the Regexp, then
// perform a "find" operation on the objectList. if the result of the find is true, the variable o will be
// set to the Object in the Module.
for id in searchList do {
if(absoluteNumberMatch id) absNo=intOf(id[match 1]) else absNo=-1
if(find(objectList, absNo, o)) accept o
}

delete searchList
delete objectList
filtering on
refresh m


Although we still loop through the list and redefine the string id, it's not quite as bad because it only does this once, not multiple times for each Object Identifier in the Module every time you call the function to accept an Object for the filter.

You should note that when looping through the Module, I use the key word entire to grab each and every Object (including filtered, deleted, table headers, etc). This way we don't need to worry about the status of the current view when looping through the Module.

Happy coding!

-Dennis

Edited: 16-Apr-2003 at 14:00 by Dennis Lockshine
Report this to a Moderator Report this to a Moderator
 17-Apr-2003 05:54
User is offline View Users Profile Print this message


Pelp  

Posts: 11
Joined: 9-Apr-2003

Dennis -

You're the man!! The code snippet worked like a charm, and you put me to shame.

I'm a very newbie to the DXL language and find it troublesome to code or if it's possible to do some tasks since not people program it such as C++ or Perl. I guess I have to start reading the DXL manual again. Did you have the same problem coding DXL when you started out? I mean, did you have to overcome the learning curve which I'm in the stage of.

Thanks!!
Pelp

-------------------------
Report this to a Moderator Report this to a Moderator
 17-Apr-2003 17:04
User is offline View Users Profile Print this message


Dennis Lockshine

Posts: 113
Joined: 7-Apr-2003

Pelp-

I'm glad that you found the code helpful. Three (or was it four?) years ago I was in the same place you were - just trying to learn DXL for DOORS 4.x. The most valuable resource for me was the online DXL syntax guide built into DOORS itself (and some of the examples available if you use the "Browse" feature of the DXL edit pane). It took some time, but based on previous C and C++ knowledge, I learned new DXL commands and new, sometimes better ways of coding the same solutions. After becoming comfortable with the language, I felt I knew enough to attended a DXL Training session offered by Telelogic and get something out of it.

So keep on coding, review the DXL Reference guide, review the example DXL, and have fun.

-Dennis
Report this to a Moderator Report this to a Moderator
 21-Apr-2003 19:43
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

As Lockshine said, "Object Identifier" is NOT a true "attribute" (neither is the paragraph "number" nor the "level") Instead of <obj."Object Identifier"> try <identifier(obj)> (or <number(obj)> or <level(obj)>. I prefer just to use the <obj."Absolute Number"> to uniquely identify objects.

If you are looking for only one object, using a filter seems like a bit of overkill. Instead, consider just setting the one you found "current":
--- current = oFound
--- refresh mod

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.