How to display the name of a module in another module that is not directly linked to it (DXL DOORS

Tags: dxl doors
Question!

I am new to DXL, and I am trying to create a master module (module A) in DOORS that has a column that displays the text from module B followed by the title of module C. Module B is linked to module A, and module C is linked to module B. I would like module A to have a column that 1) displays the contents linked from B, and 2) on the same line as each module B object, displays the module C name that is linked in to module B. I would like the name of module C to be in square brackets. It should look like this:

Within Module A First column: "text manually entered in A" Second column: "text manually entered in B [name of C]"

Currently I can bring B into a new column within A. Here is that code:

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 = probeRichAttr_(othero,"Object Text", false)
            if (s == "") 
            displayRich("\\pard " " ")
            else
            displayRich("\\pard " s)
        }
    }
}
showIn(obj,1)

Here is what I found so far from a different query: Show DXL columns from other modules

This was a useful start for displaying the name of C in square brackets in a new column in B. Here is my code for that:

    pragma runLim, 0
    int lines[4] = {0, 0, 0, 0}
    void adjustLines(int depth, showAtDepth) {
    int count
    for (count = 0; count < 4; 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]
        adjustLines(depth, 1)
        bool kick = (doneOne) && (lines[depth-1] == oldLines)
        if (kick) {
            lines[depth-1]++
            if (depth == 1) displayRich("\\pard " " ")
        }
        if (depth < 4) {
            showIn(othero, depth+1)
        }
        doneOne = true
        if (depth == 1) {
            s = name(otherMod)
            if (isBaseline(otherVersion)) {
                s = s " [" versionString(otherVersion) "]"
            }

        s = "{[" s "]}"

        displayRich s

        }
        lines[depth-1] += 3
    }
}
showIn(obj,1)

However there are 2 problems with this. 1) I have multiple links from objects in C coming into B, and for every link, it displays the name of C that many times. I would like it to display the name of C just once per object in B, so there is no redundancy. 2) The name of C is displayed as a new column in B, but I would like it to be concatenated at the end of the text in the already existing column.

Also, the linkset between A and B is in a different folder than the linkset between B and C, so the stockoverflow answer I provided above does not seem to work 1.

I suppose there are 2 different approaches to this. Have name of C displayed at end of object text in B, then have A call that B column, thus grabbing both linked objects. I would only need DXL code for B in this case. Or make A smart enough to call the B column and append the name of C to it. I would only need DXL code for A in this case.

I am not sure if this forum is the appropriate place for this question (I tried calling IBM support and they referred me here). Thank you in advance.



Answers

I know this response is a bit late and I am sure you have moved on by now, BUT... I think you are looking for something like this...

pragma runLim, 0
void showIn(Object o, int depth) {
  Link l, l2
  LinkRef lr
  ModName_ modC = null
  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 = probeRichAttr_(othero,"Object Text", false)
         for l2 in all (othero <- "*") do {
          modC = source(l2)
          s = s " [" name(modC) "]"
          break
        }

        if (s != "") 
        displayRich("\\pard " s)
    }
  }
}
showIn(obj,1)

You may need to modify it a little for your specific situation.

Good Luck!



This video can help you solving your question :)
By: admin