show descendants of an object

I would like to create a traceability column that shows for every objects in my current module (A) the linked objects in another module (B)

I did it by creating a DXL column, the thing is when my objects in the module B have descendants they don't appear in my DXL column.

Actually, I don't know how to look for the descendants of an object in DXL and I didn't find anything in the DOORS help.

Thanks for helping me...
jlnddn - Tue Jan 03 13:51:45 EST 2012

Re: show descendants of an object
PDU - Wed Jan 04 01:13:30 EST 2012

Bonjour,
exemples (from DXL help) :

In Finding objects

Object o 
Object po = current 
for o in po do {
    print (o."Object Heading") " is a child of "
    print (po."Object Heading") "\n"
}

 


In Navigation from an object
first : returns the first child of object o
last : returns the last child of object o
parent : returns the parent of object o
previous : returns the previous object from object o
in a depth first tree search (the same order as for o in module do)
next : returns the next object from object o
in a depth first tree search (the same order as for o in module do)

 

 

Object o = current 
Object co = first o 
if (null co) {
    print "Current object has no children.\n"
} else {
    if ((last o) == co) {
        print "current has one child: " (o."Object
               Heading") "\n"
        print (identifier o) " == " (identifier
               parent co) "\n"
    }
} 
if (null o[3]) 
    print "current object does not have 3rd
           child\n" 
if (null previous o)
    print "Current object is first in module.\n" 
if (null next o)
    print "Current object is last in module.\n" 
if (!null next o) {
    Object here = previous next o
    print (identifier o) " and " (identifier
           here) " are the same\n"
}



Pierre



 

Re: show descendants of an object
PatrickGuay - Fri Jan 06 13:20:21 EST 2012

If you are using filters in your dxl column you could simply use the following method

ViewDef defn = create(current Module, true/false)
useDescendents(viewdef, true/false)) // true in your case

What method are you using in order to find the link in module B?

Re: show descendants of an object
llandale - Mon Jan 09 18:06:09 EST 2012

It does not seem reasonable to me to presume that when A links to B, that it also links to all descendants of B. But lets suppose B is some sort of "as per the following list:" object, and has text children, one for each list element.

Your wizard will locate and display information about variable "othero" which is the linked B object. Thereabouts you would add something like this:

display some information about othero
Object otheroChild
for otheroChild in othero do
{  display some information about otheroChild
}


If B is a heading and can have several depths then the above code would be in some recursive function and the looped "display" would instead be a recursive call.

I prefer this solution: add to module B some attr-DXL that does the calculation for each object in B. Then your wizard layout in A just displays that attribute of linked partner B. The Attr-DXL in B may perhaps resemble this:

 

Buffer bResults = create()
if (obj is a 'clever' parent object) then
{  bResults = some info about clever parent obj
   for oChild in obj do
   {  bResults += "\n"
      bResults += some info about child oChild
   }
}
else
{  bResults = some info about normal object obj
}
obj.attrDXLName = tempStringOf(bResults)
delete(bReSults)



-Louie