Long way of doing this without directly writing to the database.
Use Find in Project to construct your SQL to get the IDs of the elements you want to update. E.g. SELECT t_object.OBJECT_ID FROM t_object WHERE ....
Once you know you have the right SQL to get the IDs you want.
- Use Repository.SQLQuery(inSQL) to get an XML recordset containing the matching records.
- Use one of the XML function libraries in EAScriptLib to parse the XML, and convert the OBJECT_ID nodes in to an array
- Convert the array in to a list of OBJECT_IDs
- Use Repository.GetElementSet(inListOfIDs,1)
Loop through the returned collection of EA Element Objects.
selectedElement.Type = newType;
selectedElement.StereoType = newStereoType;
selectedElement.StereoTypeEx = newStereoType;
selectedElement.MetaType = newMetaType;
selectedElement.Update();
selectedElement.SynchTaggedValues(newProfile,newStereoType);
Repository.AdviseElementChange(selectedElement.ElementID);
Example:
selectedElement.Type = "Actor";
selectedElement.StereoType = "OrganizationUnit";
selectedElement.StereoTypeEx = "OrganizationUnit";
selectedElement.MetaType = "OrganizationUnit";
selectedElement.Update();
selectedElement.SynchTaggedValues("TOGAF","OrganizationUnit");
Repository.AdviseElementChange(selectedElement.ElementID);