Rational DOORS, DXL, RMF, Macros, and other handy hints

Plain text version of a column

string objtext
objtext = obj."Object Text"
objtext = plainText(objtext)
display objtext

DXL for concatenated trace column

Sometimes you'd like to show the links to another document, but have them all on the same line. Say for instance you'd like to create a Trace Matrix like the following:

First, create the column by using Analysis > Wizard. This will add each link on a new line.

Then go to the Properties of this new column, then click "Browse" (next to Layout DXL).

Then click "Current".

You'll see a script. Edit the lines towards the end as shown below. This will change the returns to commas.

// DXL generated by DOORS traceability wizard on 01 November 2011.

//Modified Edward

// Wizard version 2.0, DOORS version 8.2.0.2

pragma runLim, 0

string limitModules[1] = {"47859f30132d0c13-0000a840"}

void showOut(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 l in all(o->linkModName) do {

otherVersion = targetVersion l

otherMod = module(otherVersion)

if (null otherMod || isDeleted otherMod) continue

if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue

othero = target l

if (null othero) {

load(otherVersion,false)

}

othero = target l

if (null othero) continue

if (isDeleted othero) continue

doneOne = true

if (depth == 1) {

string c = othero."Object Short Text"

s = s ", " c

}

}

display (s[2:length(s)])

}

showOut(obj,1)

DXL to display paragraph numbers

// Display paragraph number without "0-" in Object Numbers, should align with Word para numbers

string n, n2

int l, x

n = number(obj)

l = length(n)

n2=""

x = 0

while (x <= l) {

if n[x:x+1] != "0-" then {

n2 = n2 n[x:x]

x++

} else {

x++

x++

}

}

display n2

RMF and Font sizes

Finally figured out why the fonts were small. It turns out that when you tag a module using RMF (aka TREK), it changes the Locale to "French (France)".

Unfortunately our Locale is set to English (Australia), and by default when you set the fonts under Options > Display, it will modify this Locale - NOT the French one.

So it turns out, to change the font size, you need to first change the red box above to "French (France)" for it to change the fonts correctly.

Alternatively, we can change the module settings back to English (Australia) on a module by module basis after RMF has stuffed it up. This is done under "Edit Attribute > Object Text".

There could be a setting in DOORS or RMF that has been setting the locale to French. It would be nice to have it not do this, and it was only by pure chance that I decided to change this.

Convert a DXL column into an editable column

To convert a column created by the DXL wizard into a column you can edit in DOORS, perform the following steps:

1. Open the module and the view you want with the Layout DXL column.

2. Create the Attribute you want and add the Attribute column. This Attribute must be of type "String". It won't work with enumerations unfortunately.

3. Copy the Layout DXL column into an Attribute DXL column (Tools > Support Tools > Convert Layout DXL to Attribute DXL).

4. Create the required final attributes with a format of "String".

5. Copy the Attribute DXL column into the Attribute column (Tools > DXL Library > DOORS standard DXL Library > Various functions which manipulate DOORS data > Copy attribute values).

6. Remove any extra columns that are not required.

How to create a derived document with all links intact and ready for editing

One of the most common tasks in DOORS is to create a document based on a specification, deriving further requirements or allocating to subsystems. This typically involves starting from scratch, then adding links one by one. However since the derived document usually follows a similar structure, and some requirements will only require wording changes, it makes sense to just copy and link the documents, then modify the new document with all the links and headings all ready there.

Here is a procedure on how to do this.

1. Open up Source Module.

2. In the source module, convert all DXL columns into real attributes.

3. Create the view with filtering you require - making sure you don't use any DXL columns.

4. Copy the source module.

5. Rename the Copied Module.

6. In the Copied Module, amend the prefix (File > Properties > General > Prefix)

7. In Copied Module, delete all objects (Tools > DXL Library > Some example programs which illustrate various DXL features > Example to delete all objects in display set (with links as well)).

8. In the Source Module, show the view with the required filtering.

9. In the Source Module, open the DXL Library (Tools > DXL Library).

10. Run the "Copy Objects" script (DOORS standard DXL library > Various functions which manipulate DOORS data > Copy objects). Or use Tools > Functions > Copy Objects

11. In the Copy Objects dialogue box, fill in all the details and click OK, making sure that you choose:

a. Target module: Copied Module

b. Copy: "Current display set"

c. Attribute Name: Select all attributes

d. Create links: Target to source

Copying the Object Identifier column

1. Create a new column with the following Layout DXL:

display identifier obj

2. Use Tools > Support Tools > Convert Layout DXL to Attribute DXL to convert this column into Attribute DXL.

3. Use Tools > Functions > Copy attributes to copy the Attribute DXL column to the required column.

Trace column with paragraph number and linkset

string getChapter(Object o)
{
    int offset, lngth
    string sel = number(o)
    string temp = number(o)
    string tempo = ".0-"
   
    if (findRichText(sel , tempo , offset, lngth, true))
    {
        int str_end = sizeof temp
        str_end = str_end - offset
        temp = cutRichText(sel, offset,str_end )
        return "§" plainText(temp)
    } 
    else 
    {
        tempo = "-"
        if (findRichText(sel , tempo , offset, lngth, true))
        {
            int str_end = sizeof temp
            str_end = str_end - offset
            temp = cutRichText(sel, offset,str_end )
            return "§" stringOf(richText(temp))
        }
        else 
        {
            return " §" stringOf(richText(temp))
        }
    }
}
void showInlinks(Object o,string rel,bool chapter,bool ole) {
    Link l
    LinkRef lr
    string otherModName
    Module otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp,s,chap
    int count
    Module lm
    string lname
    Buffer b = create()
    for lr in all(o<-"*") do {
        lm = module(lr)
        if (rel[0] == '/')
            lname=fullName(lm)
        else
            lname=name(lm)
        if (lname != rel) continue
        otherModName = fullName(source lr)
        if (module otherModName) {
            if ((!isDeleted module otherModName) && (null data(sourceVersion lr))) {
                otherMod = read(otherModName,false)
                if (isBaseline(sourceVersion lr)) {
                    otherMod = load(otherMod,baseline(sourceVersion lr),false)
                }
            }
        }
    }
    for l in all(o<-"*") do {
        lm= module(l)
        lname=name(lm)
        if (lname != rel) continue
        otherVersion = sourceVersion l
        if (null module otherVersion) continue
        if (isDeleted module otherVersion) continue
        otherModName = fullName(otherVersion)
        othero = source l
        if (null othero) {
            otherMod=read(otherModName,false)
            if (isBaseline(otherVersion)) {
                otherMod = load(otherMod,baseline(otherVersion),false)
            }
        }
        othero = source l
        if (null othero) continue
        if (isDeleted othero) continue
        otherMod = module othero

s = name(otherMod)

if (chapter)

        {
            chap = getChapter(othero)
            s = s " " chap
        }

b = "\\pard\\b " s " [" probeAttr_(othero,"IE PUID") "] \\par"

        if (ole) b += richTextWithOle othero."Object Text"
        else b += richText othero."Object Text"
        Object lo
        for lo in othero do {
            b += '\n'
            if (ole) b += richTextWithOle lo."Object Text"
            else b += richText lo."Object Text"
        }
        s = tempStringOf b
        displayRich s
        setempty b
    }
    delete b
}
pragma runLim, 0
showInlinks(obj,"satisfies",true,false)

Reset inheritance

// access control setting example
/*
set access to inherited
*/
if (null current Module) {
   ack "Please run this program from a module"
   halt
} else if (!isEdit current) {
   ack "current module must be editable to set permissions"
   halt
}
Object o
string modName = (current Module)."Name" ""
for o in current Module do {
   string err
   err = set(o,read|write|change,null) // null means alter the
   inherited o
                                       // default ACL record
   if (!null err) {
       ack "problem setting default ACL: " err
       halt
   }
}
save current          // save your work

Random AutoIT macros for automating common tasks

Here is an AutoIT macro that allow for the following easy DOORS manipulation tasks:

F3

CTRL-DEL

CTRL-~

Lock an object

Delete all links for an object

Swap a heading with text

HotKeySet ( "{F3}", "Lock" )

HotKeySet ( "^+{DEL}", "DeleteLinks" )

HotKeySet ( "^`", "SwapHeading" )

TraySetToolTip("F3: Lock Object" & @CRLF & _

"CTRL-SHIFT-DEL: Delete Links of selected object." & @CRLF & _

"CTRL-`: Swap Heading with Text")

while 1

Sleep(100)

WEnd

func Lock()

Send("{APPSKEY}ll{ENTER}{DOWN}")

EndFunc

Func DeleteLinks ()

Send("{ESC}!le")

WinWait("Object","")

Send("{TAB}+{DOWN 20}{TAB 3}{SPACE}{TAB 2}{SPACE}")

EndFunc

Func SwapHeading ()

Send("!eow")

EndFunc