How to display selected attributes for selected levels in DOORS using DXL

ibm-doorsibm-rational

I'm looking for some DXL/DOORS help…

I have 3 modules: A, B, and C. B is linked in to A, and C is linked in to B. So B is depth 1 and C is depth 2. I am trying to create a column in A that displays the object text, module name, and object number of the inlinked objects from B and C. However, I do not want to display all 3 of these (text, name, number) for both B and C–instead I'd like to only display the object text from B and the module name and object number from C. Ideally I want the info from C to be in square brackets immediately following the info from B. I would like it to look like this:

Within a column in A:
"object text from B" ["module name of C" "object number of C"]

I have used the wizard to create the below layout DXL script, but currently it shows all 3 pieces of information for both B and C. Does anyone have any suggestions on how to print out only object text from B (depth 1), followed by module name and object number from C (depth 2)?

Note: In the below script, I tweaked the end to display s, p, and t in the order I would like them.

// DXL generated by DOORS traceability wizard on 27 October 2014.
// Wizard version 2.0, DOORS version 9.5.2.1
pragma runLim, 0
const int indentStep = 360
Buffer indentBuff = create
Buffer lineBuff = create
lineBuff = "______________________"
string indentAllParagraphs(string s, bool addBullets, int addedIndent)
{
    int numParas = 0
    RichTextParagraph rtp
    indentBuff = s
    for rtp in s do
    {
        numParas++
        Buffer t = create()
        t += rtp.text
        if (length(t) > 0 )
        {
            bool hasBullet = rtp.isBullet
            int  indentLev = rtp.indentLevel
            indentBuff = applyTextFormattingToParagraph(indentBuff, hasBullet, indentLev+addedIndent, numParas)
        }
        delete(t)
    }
    return (numParas == 0 ? "" : tempStringOf(indentBuff))
}
int lines[2] = {0, 0}
void adjustLines(int depth, showAtDepth) {
    int count
    for (count = 0; count < 2; count++) {
        while (lines[depth-1] < lines[count]) {
            if (depth == showAtDepth) displayRich("\\pard " " ")
            lines[depth-1]++
        }
    }
}
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
        int oldLines = lines[depth-1]
        doneOne = true
        {
            s = name(otherMod)
            p = probeRichAttr_(othero,"Object Number", false)
            t = probeRichAttr_(othero,"Object Text", false)
            displayRich(t" ""["s" "p"]")
        }
        lines[depth-1] += 3
        if ( depth < 2 ) {
            showIn(othero, depth+1)
        }
    }
}
showIn(obj,1)
delete indentBuff
delete lineBuff

Best Answer

Here's how I'd approach it:

In Module B: Create a DXL attribute that pulls in the info you want from Module C, e.g., an attribute called "C Object Info" that collects Module Name and Object Number. (I usually do this via Analysis > Wizard, then use Tools > Support Tools > Convert Layout DXL to Attribute DXL, then tweak the DXL). So each object in Module B that has an in-link from Module C will have this attribute "C Object Info" that can be accessed in Module A.

In Module A: Create a DXL layout (via Analysis > Wizard) that pulls in and formats the info you want from Module B: "Object Text [C Object Info]"

[I don't know if it's Good DOORS Practice to do it like this, but it makes the scripting a little easier. When I know I'm going to be taking chunks of info like "[Object ID] Object Text" across multiple levels of linking hierarchy (e.g., going from Module A customerRequirement to Module B systemRequirement to Module C subsystemRequirement, I'll have a DXL attribute for customerRequirement and subsystemRequirement in my systemRequirement module so I can access/display/manipulate the data from more than one link level away. It comes in handy for traceability reports, developing verification/validation procedures, etc.]

Related Topic