![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Filter on "Object Identifier" Topic Summary: Created On: 16-Apr-2003 04:34 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() 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 | |
![]() |
|
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 ------------------------- ![]() ![]() ![]() |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 ------------------------- ![]() ![]() ![]() |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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)>
![]() 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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Filter on "Object Identifier"
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.