Hi, |
Re: How to obtain the Module prefix for a target module? doing something like TargetMod."prefix" doesn't work. Would TargetMod."Prefix" work? DOORS is case sensitive. Cheers, Pekka |
Re: How to obtain the Module prefix for a target module?
Hi, print TargetMod."prefix" // this will fail: try to print an Attr_ print TargetMod."prefix" "" // this will work: Attr_ is translated into a plain text string before printing print richText TargetMod."prefix" // this will work: Attr_ is translated into a rich text string before printing
if (TargetMod."prefix" "" == "") { // correct syntax to test an empty prefix
|
Re: How to obtain the Module prefix for a target module? ePiallat - Wed Nov 04 02:59:40 EST 2009
Hi, print TargetMod."prefix" // this will fail: try to print an Attr_ print TargetMod."prefix" "" // this will work: Attr_ is translated into a plain text string before printing print richText TargetMod."prefix" // this will work: Attr_ is translated into a rich text string before printing
if (TargetMod."prefix" "" == "") { // correct syntax to test an empty prefix
|
Re: How to obtain the Module prefix for a target module? just a hint related to your code examples: I assume that the referenced variable "TargetMod" is of type Module. The value must be a reference to an opened module. Starting with DOORS v8.2 there's a much faster way to access module attributes without the need to open it. The only thing you need is a reference to a module of type ModName_: // ### begin code ###################################### ModName_ modRef = <initialized> string attr_Val = "" // Prepare the call to the fnc 'getProperties' ModuleVersion mod_version = moduleVersion( modRef ) ModuleProperties mod_properties = null string errmsg = getProperties( mod_version, mod_properties ) if (!null errmsg) <do some error reporting/handling> // Try to get the desired attribute; catch and report any error if not found if (find( mod_properties, attr_Name ) != null) { attr_Val = unicodeString( mod_properties.attr_Name ) } else { <do some error reporting/handling> } // ### end code ###################################### Cheers, Illo |
Re: How to obtain the Module prefix for a target module? To ePiallat: Yes, I am aware of the force to string. That didn't work. I get an oncorrectly concantanated tokens error that way. The original error is "incorrect arguments for (.)" Oh, and the "prefix" was a typo here, I actually am using "Prefix", but it doesn't seem to matter... To Illo: The variable TargetMod is of type ModName_ (a module reference). I'm working in DOORS v9.2. The code roughly looks like: Link OutLink ModName_ targetMod ... for OutLink in O->"*" do { targetMod = target OutLink read(fullName(targetMod), false) TargetObj = target(OutLink) targAbsNo = targetAbsNo (OutLink) string TargModPref = targetMod."Prefix" "" Process_log += TargModPref targAbsNo "\t" TargetObj."Object Text" "\n" } But... using Function identifier(Object) works great!! Thanks Pekka! so now the code looks like: read(fullName(targetMod), false) TargetObj = target(OutLink) targAbsNo = targetAbsNo (OutLink) string TargModPref = identifier(TargetObj) Process_log += TargModPref targAbsNo "\t" TargetObj."Object Text" "\n" and I'm a happy camper. Thanks everyone, this was a simple solution to something that was killing me. |
Re: How to obtain the Module prefix for a target module? My previous entry was poor (I got excited that it worked!) The corrected code is: ... targetMod = target OutLink read(fullName(targetMod), false) TargetObj = target(OutLink) string TargModPref = identifier(TargetObj) Process_log += TargModPref "\t" TargetObj."Object Text" "\n" ... Sorry for the double post. Got excited that it worked. -Steve |
Re: How to obtain the Module prefix for a target module? SteveK01 - Wed Nov 04 18:43:48 EST 2009 For further notice, the problem was that "targetMod" is not a Module, but a ModName_. If you need some module property from an open module some days, try to write this instead: Link OutLink ModName_ targetModName Module targetMod ... for OutLink in O->"*" do { targetModName = target OutLink targetMod = read(fullName(targetModName), false) TargetObj = target(OutLink) targAbsNo = targetAbsNo (OutLink) string TargModPref = targetMod."Prefix" "" Process_log += TargModPref targAbsNo "\t" TargetObj."Object Text" "\n" } |