IBM Doors DXL: Rename/Replace Enumeration Value of a DataType – Enumerationswert ändern


An existing enumeration value should be renamed or replaced

Approach – Ansatz

We have to iterate through the Type-Array and repopulate new arrays, which will be used as parameters for the modify function

Solution – Lösung

//This program was intended to replace the values of an enumerated attribute
//The replace will not affect the current selected values, it will just change the value to the new one
pragma runLim, 0
void replaceAttributeTypeValue(Module m, string atName, string oldVal, string newVal){
    AttrType att = find(m, atName)
        //Declare Arrays Size
        int colores[att.size]
        int arrMap[att.size]
        string arr[att.size]
        int arrVal[att.size]
        int i
        //Populate Arrays
        for(i = 0; i < att.size; i++){ 
                arr[i] = att.strings[i]
                arrVal[i] = i
                colores[i] = -1
                arrMap[i] = i
        for(i = 0; i < sizeof(arr); i++){ 
                if(arr[i] == oldVal){
                        arr[i] = newVal
        string err = null
        AttrType at2 = modify(att, atName, arr, arrVal, colores, arrMap, err)
        if(!null err){
                print "Failed: " err"\n"
                infoBox " - Modified Successfully"

Über Björn Karpenstein

Diplom Informatiker, Programmierer, Musikbegeisterter
Dieser Beitrag wurde unter DXL, IBM DOORS veröffentlicht. Setze ein Lesezeichen auf den Permalink.

4 Kommentare zu IBM Doors DXL: Rename/Replace Enumeration Value of a DataType – Enumerationswert ändern

  1. Srikanth sagt:

    I tried this function but not getting success. and the below error I’m getting.
    „incorrect use of identifier“ Please help me to resolve this error. And also what is the „Allocation“ in „modify“ function.

  2. AttrType modify(AttrType type,
    string newName
    [, string codes[ ],
    int values[ ],
    int colors[ ],
    string descs[ ]
    [, int arrMaps[ ],]]
    string &errmess)

    AttrType modify(AttrType type,
    AttrBaseType new,
    string &errmess)

    The first form, without any optional parameters, changes the name of the specified attribute type to newName. If supplied, codes, values, colors and descs modify those properties of an existing enumerated type. In the user interface, the term values maps to codes, and the term related numbers maps to values. If the type is being used by an attribute, colors cannot be added where they were not previously assigned, and, arrMaps must be supplied in order to map old values to the new ones.

    The second form changes the base type of the specified attribute type. If type is in use the call fails.

    Note: Color numbers now refer to real colors rather than logical colors. Enumerated attribute types in Rational DOORS 4 have their colors translated during migration.

    For all forms, the errmess argument is currently not used, but is reserved for future enhancements. You can trap errors using lastError and noError.

    Note: This function expects arrays of real colors as arguments. Therefore, prior to any calls being made to modify, the setRealColorOptionForTypes function must be called setting realColors to true.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.