Hi!
Our objects (Roles, DKOs, etc) are kept on libraries and part of the housekeeping that we do is to check whether the object is still used on the live models. If not, we're supposed to removed it from the libraries. Currently, I check it using the report "Output occurrences of objects" after which I have to manually scan which is a very time-consuming task.
Do we have other available reports that can just give me a report which can directly tell me which has no occurrence to live models?
Thanks in advance!
BR,
Julie
Hi Julie,
You can try the below script, its working for me :
function main(){
var oCurrentDatabase=ArisData.getSelectedDatabases()[0];
var arrSelectedGroups= ArisData.getSelectedGroups();
var g_nLoc = Context.getSelectedLanguage();
g_oOutfile = Context.createOutputObject(Context.getSelectedFormat(), Context.getSelectedFile());
g_oOutfile.Init(g_nLoc);
var Obj = oCurrentDatabase.Find(Constants.SEARCH_OBJDEF);
var len=Obj.length
for(var a = 0; a <Obj.length; a ++){
var Objocc= Obj[a].OccList();
var l=Objocc.length;
if(l==0){
g_oOutfile.OutputLn( Obj[a].Name(Context.getSelectedLanguage()) +" ; " + Obj[a].Group().Path(Context.getSelectedLanguage()), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, 0);
}}
g_oOutfile.WriteReport(Context.getSelectedPath(), Context.getSelectedFile());
}
main();
Well, but both solutions won't help you with models that are still in a library model.
You would have to go through the occurrences of the object and check if they have any occurrence e.g. in an epc or fad...
for(var a = 0; a <Obj.length; a ++){
bValidFound = false;
var ObjoccList= Obj[a].OccList();
for (i = 0; i < oObjoccList.length; i++){
oObjOcc = oObjOccList[i];
if (oObjOcc.Model().TypeNum() == Constants.MT_EEPC || oObjOcc.Model().TypeNum() == Constants.MT_FUNC_ALLOC_DGM){
bValidFound = true;
break;
}
}
if (!bValidFound){
// delete object or report it to word etc.
}
}
BR Robert