Compare attribute values in module to analysis wizard

Hi all,

I am currently trying to find a way to automatically tell me what requirements have been verified by comparing a V&V module to my requirements modules.  I am currently using the approach of doing analysis wizard on my requirements modules using the in-links from my V&V module.  My V&V module has two colums "Verified Reqs" and "Unverified Reqs."  I am doing analysis wizard on the V&V object identifier and the Unverified Req attribute.  I want the script to go through each link, identify if the requirement module object has the number in Unverified Req from the V&V module.  If the requirement identifier matches something in the V&V module object Unverified Req attribute, I want to display the object identifier of the V&V object in the layout DXL column within the requirements module.  Sorry, I hope that isn't too convoluted.  Here's my code so far:

// DXL generated by DOORS traceability wizard on 19 April 2017.
// Wizard version 2.0, DOORS version 9.6.1.3

Object o

pragma runLim, 0
string limitModules[1] = {"4d4f840328d44d3f-00036824"}
void showIn(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 lr in all(o<-linkModName) do {
        otherMod = module (sourceVersion lr)
        if (!null otherMod) {
            if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
                if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue
                load((sourceVersion lr),false)
            }
        }
    }
    for l in all(o<-linkModName) do {
        otherVersion = sourceVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue
        othero = source l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = source l
        if (null othero) continue
        if (isDeleted othero) continue
        doneOne = true
        if (depth == 1) {
            s = (identifier othero)
            s1 = probeRichAttr_(othero,"Unverified Reqs", false)

           for o in current Module {
            if identifier=s1 {
            if (s1 == "") 
            displayRich("\\pard " " ")
            else
            displayRich("\\pard " s)
         }
        }
    }
}

showIn(obj,1)

I'm getting a syntax error on line 49, incorrect argument for (=) line 49, 50 syntax error, 61.  I expect the error comes from trying to set identified=s1, but I have no idea how to compare those values otherwise or how to turn identified into text.  Any help would be greatly appreciated.  Thank you.


geemo - Wed Apr 19 16:03:23 EDT 2017

Re: Compare attribute values in module to analysis wizard
PekkaMakinen - Thu Apr 20 04:58:12 EDT 2017

You are getting the error because all logical comparisons with "if" should be in parentheses and use the comparison operator "=="

 

So it should be if (identifier == s1)

 

Please check the first chapters of the DLX Reference (DXL Help)

Re: Compare attribute values in module to analysis wizard
thsturm - Thu Apr 20 05:07:49 EDT 2017

PekkaMakinen - Thu Apr 20 04:58:12 EDT 2017

You are getting the error because all logical comparisons with "if" should be in parentheses and use the comparison operator "=="

 

So it should be if (identifier == s1)

 

Please check the first chapters of the DLX Reference (DXL Help)

This was also my first impression, BUT this is an assignment of a string(?) ("s1") to a DXL perm ("identifier") which must crash.

I am not sure, what the meaning of the "if" is?

What should be equal ("==")?

if (identifier o == s1)     // maybe this is intended?

Re: Compare attribute values in module to analysis wizard
geemo - Thu Apr 20 10:47:07 EDT 2017

thsturm - Thu Apr 20 05:07:49 EDT 2017

This was also my first impression, BUT this is an assignment of a string(?) ("s1") to a DXL perm ("identifier") which must crash.

I am not sure, what the meaning of the "if" is?

What should be equal ("==")?

if (identifier o == s1)     // maybe this is intended?

Thanks for the syntax help.  That is definitely the first step...

 

thsturm is right though, I don't know how to make a comparison between the identified perm and the string pulled out of the other module through analysis wizard.

 

If it's not possible to make a direct comparison, is there a way to turn the identified perm into a string so that I can make the direct comparison?  The meaning I am going for is that for each object in the current module, I would like to see if the value of the identifier perm is the same as the value of the s1 value pulled from my other module.  Thanks for the help so far.  

Re: Compare attribute values in module to analysis wizard
thsturm - Fri Apr 21 02:52:34 EDT 2017

geemo - Thu Apr 20 10:47:07 EDT 2017

Thanks for the syntax help.  That is definitely the first step...

 

thsturm is right though, I don't know how to make a comparison between the identified perm and the string pulled out of the other module through analysis wizard.

 

If it's not possible to make a direct comparison, is there a way to turn the identified perm into a string so that I can make the direct comparison?  The meaning I am going for is that for each object in the current module, I would like to see if the value of the identifier perm is the same as the value of the s1 value pulled from my other module.  Thanks for the help so far.  

The 'identifier' gives you the object id as a string:

 

Declaration
     string identifier(Object o)

Operation
     Returns the identifier, which is a combination of absolute number and module prefix, of object  o  as a string.

 

So you can compare the string of one object id with the an object id of another object.