Profile picture for user nivas4310

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.

by Christoph Reitenberger
Posted on Wed, 03/06/2013 - 10:06

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

0
by Srinivas CH Author
Posted on Wed, 03/06/2013 - 10:33

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.

0
by Christoph Reitenberger
Posted on Wed, 03/06/2013 - 11:40

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

0
by Srinivas CH Author
Posted on Wed, 03/06/2013 - 12:58

Hi Christoph,

Thanks for your reply, Anyhow the solution which you posted above is working, I can able to delete the object definitions from DB. Thanks :) :)

BR/Srinivas.

0
by Hazem Shuqair
Posted on Thu, 12/29/2016 - 11:06

In reply to by nivas4310

HI Srinivas,

Can you please send me the script for deleting an object by GUID. I am not familiar with creating or editing scripts.

Thank you.

Hazem.

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CP
  • BZ
  • Profile picture for user TEF_Bernd
  • ПЦ
  • CR
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock