Delete Attribute in multiple modules

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.

Am wondering if anyone has a slick script that will delete a specific attribute in multiple modules or if I'm going to have to go in and do it manually. I've got the script that propagated the view and the attribute, but I don't seem to have one that will do the opposite.

thanks
richmason - Wed Apr 22 10:25:13 EDT 2009

Re: Delete Attribute in multiple modules
ozguraltay - Mon Mar 05 01:35:47 EST 2012

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
kumars963 - Mon Jul 24 07:19:31 EDT 2017