![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: how to test for a module attribute without crashing DXL Topic Summary: Module attributes Created On: 13-Dec-2005 23:04 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I am writing a script to get the information out of project modules by using a for loop through a project.
One of the attributes is a module attribute which I am testing whether or not it exists if (exists attribute "allocation"){ string s = m."allocation""" } the dxl halts because the module attribute doesn't exist, is there a better way to test for a module attribute? I also tried: AttrDef ad = find(m, "allocation") if (!null ad) string s = m."allocation""" but it still crashes. |
|
![]() |
|
![]() |
|
Use the AttrDef properties, like this:
AttrDef ad = find(m, "allocation") if (!null ad && ad.module) { string s = m."allocation" "" } ------------------------- Shawn Stepper shawn.e.stepper@wellsfargo.com |
|
![]() |
|
![]() |
|
Shawn's solution is the best one. It insure that the attribute is in fact a module level attribute, and not just a text attribute (such as Object Text).
The original code had the failing that the "exists" command works only the the "current" module, which is usually but not always the last module opened. Before such commands, explicitely set the current module "current = m". You can trap DXL crashes around lines of code like this: noError() s = m."allocation" string ErrMess = lastError() if (!null ErrMess) print ErrMess; s is no good. else s is good. - Louie |
|
![]() |
|
![]() |
|
Thanks Shawn, Louie, I'll try both of your solutions.
|
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.