DXL Script to product selective trace report

I have been using the DOORS Analysis Wizard to produce Layout DXL Columns that show traceability reports to objects in linked modules and save as part of a view. This issue is that this wizard only allows reports to be produced for links to "All Modules", "All Open Modules" and "Specific"  modules. I would like to be able to produce a Layout DXL Column that shows traceability reports for links to a number (more than one) of specific formal modules by (for example) selecting the names of modules from a list. I can then save this as a view that can then be run regularly to show the traceability to these modules in the same column.

Does anyone have some DXL code that will fulfil this requirement or can provide me with some simple guidance on how to modify Layout DXL code generated by the Analysis Wizard to specify more than one specific modules? I am happy to do a little of manipulation of DXL code to specify the modules if required (I have some coding skill but not DXL).

 


LeithMudge - Thu Jun 22 02:31:35 EDT 2017

Re: DXL Script to product selective trace report
O.Wilkop - Thu Jun 22 08:47:19 EDT 2017

One easy way (even though not the best in terms of performance or style) would be to just create a Analysis Wizard LDXL for "all modules", then rightclick -> properties on the generated column, "browse" next to Layout DXL, "current" to get the generated code and then modify that one.

 

If I do the above I get a code like this:

// DXL generated by DOORS traceability wizard on 22 June 2017.
// Wizard version 2.0, DOORS version 9.6.1.3
pragma runLim, 0
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))) {
                load((sourceVersion lr),false)
            }
        }
    }
    for l in all(o<-linkModName) do {
        otherVersion = sourceVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) 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)
            if (s == "") 
            displayRich("\\pard " " ")
            else
            displayRich("\\pard " s)
        }
    }
}
showIn(obj,1)

 

the two lines towards the end with the "displayRich()" are the ones that write the values into the column, you could encapsulate those with a simple if-condition and for example check "if(fullName(module(othero)) == "/Project/Folder/Modulename")". If you have a lot of modules you can consider creating a Skiplist and using the find() function to check if the module is in the "list of modules to trace". If performance is a concern you'd want to apply the check before the load() functions, as those open the source modules, which might take quite long depending on the size of the module.

Re: DXL Script to product selective trace report
ADent - Tue Jun 27 03:48:39 EDT 2017

In the line above:

        if (null otherMod || isDeleted otherMod) continue
add code to test for module names and if invalid exit loop:

if (otherMod name != "Module Name 1" && otherMod name != "Module Name 2") continue