I have a question very similar to the one in this thread.
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 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 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 }
|
Re: You cannot edit the attribution type ... as it is in use 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 SystemAdmin - Mon Oct 26 10:20:33 EDT 2009
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)
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)
|