How to return the baseline suffix for a module?

I'm a DXL beginner. I've generated DXL using the traceability wizard. I want the suffix of the module I linked to be included in the target module name. The generated code includes this:

s = name(otherMod)
if (isBaseline(otherVersion)) {
s = s " "
}

...but that would only retrieve the version number. Plus I can't get it to return anything, even when the module linked to is baselined.

How do I get this to work?
SystemAdmin - Thu Jul 05 20:42:27 EDT 2012

Re: How to return the baseline suffix for a module?
llandale - Fri Jul 06 11:09:40 EDT 2012

Try:
  • string NameMod = name(mod) "-" version(mod)

-Louie

Re: How to return the baseline suffix for a module?
SystemAdmin - Tue Oct 23 12:27:15 EDT 2012

llandale - Fri Jul 06 11:09:40 EDT 2012
Try:

  • string NameMod = name(mod) "-" version(mod)

-Louie

Thanks for your response. I tried that, and it gave me errors. Here's the full code, mostly generated by the wizard, then edited by me.
 

// DXL generated by DOORS traceability wizard on 05 July 2012.
// Wizard version 2.0, DOORS version 9.3.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string ModSuffix = null
    string mv = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    string linkModName = "*"
    for l in all(o->linkModName) do {
        otherVersion = targetVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = target l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = target l
        if (null othero) continue
        if (isDeleted othero) continue
        doneOne = true
        if (depth == 1) {
            s = name(otherMod)
            mv = " [" versionString(otherVersion) "]"
//            if (isBaseline(otherVersion)) {
//                s = s " [" versionString(otherVersion) "]"
//            }
            displayRich("\\pard " mv)
 
            s = s mv
            displayRich("\\pard " s)
 
            string ModSuffix = name(otherMod) "-" version(otherMod)
            display("NameMod")
 
            s = probeRichAttr_(othero,"Object Heading", false)
            displayRich("\\pard " s)
 
            s = probeRichAttr_(othero,"Object Number", false)
            displayRich("\\pard " s)
 
        }
    }
}
showOut(obj,1)

 


The mv currently outputs just "[]".

The errors are:

 

 

-E- DXL: <Line:43> incorrect arguments for function (version)
-E- DXL: <Line:43> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 2. Warnings reported: 0.



Thanks for your continued help!



 

Re: How to return the baseline suffix for a module?
llandale - Tue Oct 23 15:52:14 EDT 2012

SystemAdmin - Tue Oct 23 12:27:15 EDT 2012

Thanks for your response. I tried that, and it gave me errors. Here's the full code, mostly generated by the wizard, then edited by me.
 

// DXL generated by DOORS traceability wizard on 05 July 2012.
// Wizard version 2.0, DOORS version 9.3.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string ModSuffix = null
    string mv = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    string linkModName = "*"
    for l in all(o->linkModName) do {
        otherVersion = targetVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = target l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = target l
        if (null othero) continue
        if (isDeleted othero) continue
        doneOne = true
        if (depth == 1) {
            s = name(otherMod)
            mv = " [" versionString(otherVersion) "]"
//            if (isBaseline(otherVersion)) {
//                s = s " [" versionString(otherVersion) "]"
//            }
            displayRich("\\pard " mv)
 
            s = s mv
            displayRich("\\pard " s)
 
            string ModSuffix = name(otherMod) "-" version(otherMod)
            display("NameMod")
 
            s = probeRichAttr_(othero,"Object Heading", false)
            displayRich("\\pard " s)
 
            s = probeRichAttr_(othero,"Object Number", false)
            displayRich("\\pard " s)
 
        }
    }
}
showOut(obj,1)

 


The mv currently outputs just "[]".

The errors are:

 

 

-E- DXL: <Line:43> incorrect arguments for function (version)
-E- DXL: <Line:43> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 2. Warnings reported: 0.



Thanks for your continued help!



 

variable "otherMod" is of type "ModName_". I think this will work:
  • version(module(otherMod))

However I notice that variable 'ModSuffix' in that line is never used
  • string ModSuffix = name(otherMod) "-" version(otherMod)
... and that ModSuffix is defined near the top of the module; which means you have two.

I think you can remove that line entirely. There seems to be some display issues in the code; "mv" gets displayed twice.

-Louie

Re: How to return the baseline suffix for a module?
SystemAdmin - Tue Oct 23 17:00:25 EDT 2012

llandale - Tue Oct 23 15:52:14 EDT 2012
variable "otherMod" is of type "ModName_". I think this will work:

  • version(module(otherMod))

However I notice that variable 'ModSuffix' in that line is never used
  • string ModSuffix = name(otherMod) "-" version(otherMod)
... and that ModSuffix is defined near the top of the module; which means you have two.

I think you can remove that line entirely. There seems to be some display issues in the code; "mv" gets displayed twice.

-Louie

Louie,
Thanks for your response. I'm picking up some good tips. I can declare variables at the same time as defining them. Types are very important (obviously). Adding "String" to some functions defines the type? e.g. "version" vs "versionString"?

I've cleaned up the code a bit based on your suggestions - I had been tweaking and changing stuff ad hoc. A couple of things are done twice, to check what works.

I tried what you suggest, but it still gives me errors.

// DXL generated by DOORS traceability wizard on 05 July 2012.
// Wizard version 2.0, DOORS version 9.3.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    string linkModName = "*"
    for l in all(o->linkModName) do {
        otherVersion = targetVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = target l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = target l
        if (null othero) continue
        if (isDeleted othero) continue
        doneOne = true
        if (depth == 1) {
            string mn = name(otherMod)
            string mv = "[" versionString(otherVersion) "]"
//            if (isBaseline(otherVersion)) {
//                s = s " [" versionString(otherVersion) "]"
//            }
//            displayRich("\\pard " mv)
//
//            s = s mv
//            displayRich("\\pard " s)
 
            display("This is mn and mv: " mn " " mv)
 
            string NameAndSuffix = name(otherMod) "-" version(module(otherMod))
            display("Variable NameAndSuffix: " NameAndSuffix)
 
            string oh = probeRichAttr_(othero,"Object Heading", false)
            displayRich("\\pard Object Heading: " oh)
 
            string on = probeRichAttr_(othero,"Object Number", false)
            displayRich("\\pard Object Number: " on)
 
        }
    }
}
showOut(obj,1)

And the errors:

-E- DXL: <Line:43> incorrect arguments for function (module)
-E- DXL: <Line:43> incorrect arguments for function (version)
-E- DXL: <Line:43> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 3. Warnings reported: 0.

It seems module() and version() return different things depending on whether the module in question is open or not, which seems crazy.

 

Re: How to return the baseline suffix for a module?
llandale - Wed Oct 24 15:38:10 EDT 2012

SystemAdmin - Tue Oct 23 17:00:25 EDT 2012

Louie,
Thanks for your response. I'm picking up some good tips. I can declare variables at the same time as defining them. Types are very important (obviously). Adding "String" to some functions defines the type? e.g. "version" vs "versionString"?

I've cleaned up the code a bit based on your suggestions - I had been tweaking and changing stuff ad hoc. A couple of things are done twice, to check what works.

I tried what you suggest, but it still gives me errors.

// DXL generated by DOORS traceability wizard on 05 July 2012.
// Wizard version 2.0, DOORS version 9.3.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    string linkModName = "*"
    for l in all(o->linkModName) do {
        otherVersion = targetVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = target l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = target l
        if (null othero) continue
        if (isDeleted othero) continue
        doneOne = true
        if (depth == 1) {
            string mn = name(otherMod)
            string mv = "[" versionString(otherVersion) "]"
//            if (isBaseline(otherVersion)) {
//                s = s " [" versionString(otherVersion) "]"
//            }
//            displayRich("\\pard " mv)
//
//            s = s mv
//            displayRich("\\pard " s)
 
            display("This is mn and mv: " mn " " mv)
 
            string NameAndSuffix = name(otherMod) "-" version(module(otherMod))
            display("Variable NameAndSuffix: " NameAndSuffix)
 
            string oh = probeRichAttr_(othero,"Object Heading", false)
            displayRich("\\pard Object Heading: " oh)
 
            string on = probeRichAttr_(othero,"Object Number", false)
            displayRich("\\pard Object Number: " on)
 
        }
    }
}
showOut(obj,1)

And the errors:

-E- DXL: <Line:43> incorrect arguments for function (module)
-E- DXL: <Line:43> incorrect arguments for function (version)
-E- DXL: <Line:43> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 3. Warnings reported: 0.

It seems module() and version() return different things depending on whether the module in question is open or not, which seems crazy.

 

Sorry.
  • string NameAndSuffix = name(otherMod) "-" version(module( othero ))

I see that "versionString" (variable "mv") returns null when the link is coming from a current version of the module

No. the "String" in perm "versionString" does not imply some form of "string" varient of perm "version". And even if it did you could not infer the same for other perms; I'm sure perm names are created by diverse folks in the development team and there was no coordinated policy like that.

-Louie