I screwed up. I've been trying to do this whole recursive traceability view in all my modules, and I created a attdxl attribute, that while only updated when the view is shown, is still impacting every module because even a simple filter on "any attribute" is severely affected. |
Re: Delete Attribute in multiple modules
I have a code that Creates or Deletes a specific attribute in all modules in folder:
DB gui= create "Create Attribute"
string attrLabels[] = {"Text", "Integer", "Boolean"}
string createOrDelete[] = {"Create", "Delete"}
DBE dbeChoice = choice (gui, "Attr Type:", attrLabels, 0)
DBE dbeFreeText = text (gui, "Attr Name", "", 50, false)
DBE dbeRadioBox = radioBox (gui, "Select:", createOrDelete, 0)
Module m
Item i
void buttonOK (DB gui){
string strAttrName = get dbeFreeText
string strAttrType = get dbeChoice
int strAttrCreateOrDelete = get dbeRadioBox
for i in current Folder do {
if (type(i) == "Formal") {
m = edit (name i, false)
AttrDef ad = find(m, strAttrName)
if (strAttrCreateOrDelete == 0) {
if (null ad) {
create object type strAttrType attribute strAttrName
save m
close m
print "Attribute *" strAttrName "* of type *" strAttrType "* CREATED for module " name i "!\n"
}
else {
print "Attribute *" strAttrName "* already exists for module " name i "!\n"
}
}
else {
if (null ad) {
print "Attribute *" strAttrName "* is not found for module " name i "!\n"
}
else {
delete (ad)
save m
close m
print "Attribute *" strAttrName "* of type *" strAttrType "* DELETED for module " name i "!\n"
}
}
}
}
}
ok (gui,"Apply!", buttonOK)
show gui
|
Re: Delete Attribute in multiple modules |