Hi All,
Can you please help me to remove an object from Database through script? I have written a script using "Remove" function and it is removing the objects from the model.
However if I go to "Explorer" window I can see still the objects are lying in the folder but not in the model diagram. Does anyone faced this kind of issue? Below is the code snippet.Thanks in advance.
var documents = models.ObjOccListFilter(Constants.OT_INFO_CARR); if(documents) { for(k = 0; k <= (documents.length-1); k++) { var lstDoc = documents[k]; if((lstDoc.getSymbol()==892)||(lstDoc.getSymbol()==1649)||(lstDoc.getSymbol()==1650)) { lstDoc.Remove(); } } }
Best Regards,
Srinivas.
Hello Srinivas,
as you mentioned, you are only deleting the occurence in the model.
You need to delete the object definition in your database.
To do that, you have to select the object definition of your occurence by e.g.:
var oMyObjectToDelete = mylstDoc.ObjDef();
The delete an Item/object definition method is in:
Report class Group - Method Delete
Delete ( Item ItemToDelete )
So you have to get the group, your object definition is in via e.g.:
var gMyObjectToDeleteGroup = oMyObjectToDelete.Group();
Then you can use the method above:
gMyObjectToDeleteGroup.Delete(oMyObjectToDelete);
Be very careful running this method by script, tho! ;)
Instead of initiating your if-clause with if(documents), i would rather use if(documents.length>0).
And to make double sure, you delete the correct object, you can use the GUID method to identify your objects.. (ObjDef.GUID(), the GUID-method is inherited in any Item)
Regards
Christoph
Hi Christoph,
Thank you so much, See the thing is whenever we have done synchronization with SolMan, we are getting some new documents into our FAD's. Reason may be in SolMan we have another documents as well.
So as a temporary solution, I am creating a report where it will remove those documents which are added after Sync.
Do we have any permanent solution to this? We dont want to see any other doucments to be added to ARIS other than "General Documentation" after sync with SolMan. Now we are getting Test documentation, Training documentation and Project documentation in FAD's during sync.
Thanks in advance.
BR/Srinivas.
Hi Srinivas,
since I don´t know SolMan and how you do the sync (do you use an ARIS method?), or if you have any chance to change/edit the interface from SolMan to ARIS, the report you are implementing seems to be the obvious solution.
If you are using an ARIS method, it might be possible to edit the import script.
Unfortunately I do not have a better solution, without further knowledge. You should try to find a way to limit the information which is imported from SolMan. Maybe you can make a copy of the information you try to import and delete unnecessary/unwanted information before importing to ARIS? Or you can edit the import method to import only needed/wanted information?
Hopefully someone else is able to help you.
Greetings, Christoph