You cannot edit the attribution type ... as it is in use

I have a question very similar to the one in this thread.

I am trying to add a new entry to a multi-value attribute's enumeration list, but I am getting the error message: "You cannot edit the attribution type AttributeType as it is in use".

What does this message mean, exactly? The in-use restriction described in the reference manual states:

The third form changes the name, codes, values and colors of an existing enumerated type, provided it is not in use. If type is in use, the following restriction applies so that the new version is not incompatible with the old:

* Colors cannot be added if type does not already have colors assigned.

The type that I am modifying does already have a color assigned to each entry, so I do not understand why I am getting this failure and message.

Can someone explain what I may be doing wrong?
 

Module m = current
string attrType = "AttributType"
string name = "NewEntry"
int color = 15
 
AttrType t = find(m, attrType)
int oldSize = t.size
 
newSize = oldSize + 1
string names[newSize]
int expandedColors[newSize]
int expandedvalues[newSize]
 
int maxValue = 0
for (i=0; i < oldSize; ++i)
{
  names[i] = t.strings[i]
  expandedColors[i] = t.colors[i]
  expandedvalues[i] = t.values[i]
  if (expandedvalues[i] > maxValue) { maxValue = expandedvalues[i] }
}
 
names[oldSize] = name
expandedColors[oldSize] = color
expandedvalues[oldSize] = maxValue + 1
msg = ""
setRealColorOptionForTypes(true)
AttrType mod = modify(t, attrType, names, expandedvalues, expandedColors, msg)
if (!null(msg)) {print msg "\n"}

SystemAdmin - Fri Oct 23 17:04:51 EDT 2009

Re: You cannot edit the attribution type ... as it is in use
SystemAdmin - Sat Oct 24 08:32:23 EDT 2009

The message you received is clear if you have the background to understand the message.

In laymen terms, because the attribute & enumerated type are bound together -- documented dxl can not be used to update the enumerated type while the binding exists.

Through the GUI, a user can update the enumerated type -- but apparently this does not involve documented dxl.

DXL scripts have been written that unbinds the type from the attribute, updates the type, then recreates the binding. However, these scripts are usually tailored for specific instances and usually are not one size fits all.

For most situations -- using the GUI is fastest way to go.

Re: You cannot edit the attribution type ... as it is in use
llandale - Sun Oct 25 16:41:59 EDT 2009

Preamble: lets say the old values are and you want to add "none". If you sent the modify a command this list: , what do you suppose will happen for objects that are currently marked "medium"? Will they still be "medium" or will they get translated to "low", the 2nd in the list? Well, you need to tell DOORS your intentions.

I'm confident (but not sure) that when you add an enumeration, you <must> provide the mapping function vector. In the case above, that vector would look like: -1 0 1 2. Since the "0" is in position 1, it says that the new list of enumerations in position 1 is mapped to the old enumerations in position 0, which is "low". If we retain that mapping vector -1 0 1 2 and provide this list of enumerations: , then objects previous marked as "low" will get translated to "trivial". If we send , the low goes to trivial and then high values become low.

For you, add these:
int MappingnewSize
...
Mapping[i] = i
...
MappingoldSize = -1
and add 'mapping' in your 'modify' before 'msg'. Or no msg if you are in a Chinese restaurant.

Having said that, there is an odd 'feature' that objects will still display the OLD values even after you re-map them. For you that doesn't matter since you didn't change any, but if you did then it would be prudent to do the following, to update the display:
for obj in entire mod do
{ if (isDeleted(obj)) continue
obj.NameAttr = obj.NameAttr
}

  • Louie

Re: You cannot edit the attribution type ... as it is in use
SystemAdmin - Mon Oct 26 10:20:33 EDT 2009

Thanks Promethious and Louie.

Louie, I assume the mapping option you mention is in a later version of Doors/DXL than what I have available - 8.1 - as no such option appears in the docs I have.

Sounds like my best option for now is to just insist that the user set up the enumeration manually.

Scott.

Re: You cannot edit the attribution type ... as it is in use
ePiallat - Mon Oct 26 11:25:41 EDT 2009

SystemAdmin - Mon Oct 26 10:20:33 EDT 2009
Thanks Promethious and Louie.

Louie, I assume the mapping option you mention is in a later version of Doors/DXL than what I have available - 8.1 - as no such option appears in the docs I have.

Sounds like my best option for now is to just insist that the user set up the enumeration manually.

Scott.

This perm was undocumented up to version 8.2, but works from version 4 to 9 of DOORS, and its behaviour alegedly didn't change from version 5 (I can confirm it didn't change from version 5.2 to 9.0)

The text below comes from DOORS 8.2 help:

AttrType modify(AttrType type,
                string newName,
                  string &errmess) 
AttrType modify(AttrType type,
                AttrBaseType new,
                 string &errmess) 
AttrType modify(AttrType type,
                 string newName,
                 string codes[ ],
                 int values[ ],
                 int colors[ ],
                   string &errmess) 
AttrType modify(AttrType type,
                 string newName,
                 string codes[ ],
                 int values[ ],
                 int colors[ ],
                 int arrMaps[ ],
             string &errmess)


Operation
The first form changes the name of the specified attribute type to newName.

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

The third form changes the name, codes, values and colors of an existing enumerated type, provided it is not in use. If type is in use, the following restriction applies so that the new version is not incompatible with the old:

Colors cannot be added if type does not already have colors assigned.
The fourth form must be used when the type is currently in use by an attribute.

Note: In the user interface for DOORS 6.0, the term values maps to codes, and the term related numbers maps to values.

Note: Color numbers now refer to real colors rather than logical colors. Enumerated attribute types in 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.