Profile picture for user VladoB

Hi all,

I can't to remove occurence and connection from model. I use Remove() method, but it has no effect. What could be reason for that this is not successful?

For example - I have simple report run on object. There are 2 lines in report:

var oOccs = ArisData.getSelectedObjOccs();
oOccs[0].Remove();

I tried unsuccessfully this code for connection:

oCxnList = oOccs[o].CxnOccList();
oCxnList[0].Remove();

or

oCxnList[0].Cxn().Delete(false);

Object and connection are still in model... :(

Do you have any idea?

P.S. What is difference between relations and connections?

by Abhijit Das
Posted on Mon, 01/16/2012 - 05:54

Hi Vladimir,

Just out of curiosity what is your context when you are running the script. If the context is not set object then it will not give you anything in oOccs.

I do have a code which work in Cxns() for ObjOccs.

var lCxnOcc=selObjOcc.Cxns();

lCxnOcc[0].Remove();

 

And obviously the selObjOcc.Remove() also work.

Check if you are getting anything in the oOccs.

If you are still getting the error chekc with the Software AG. Is it with a particular release.

Sorry I can help only this much.

Thanks

Abhijit Das

abhijit.das@cba.com.au

 

 

 

0
by Vladimir Bis Author
Posted on Mon, 01/16/2012 - 08:16

Hi Abhijit,

thank you for your valuable feedback!

You are right, problem was in context - when I catch selected occurences, I have model opened of course and this is problem, model must be closed! So if I tried remove connection on model context or object definition context, connection was removed successfully!

In any case I don't understand difference between Cxns() and CxnOccList() methods, because I use always connection definiton, not connection occurence. I don't know when is suitable to use connection occurence...

0
by Edwin Verstraeten
Posted on Tue, 01/17/2012 - 10:26

Hi Vladimir,



The difference is quite simpel. The CxnOccList() returns the occurrence of all connections on a model. The Cxns() method returns the connection definitions (the actual definition of the connection in the database). In a macro you can remove the connection occurrences from the opened model, as well as the object occurrences on this model. You can't remove the definitions as long as the model is opened and the occurrences are still in scope (for undo purposes). You should be able to remove the definitions if you first save the model. Try the below example that removes all selected connections from a model, saves the model and then deletes all the connection definitions.

var oCxnOccs = Context.getSelectedCxnOccs();
var oCxnDefs = new Array();
var oModel   = Designer.getModel(oCxnOccs[0]);

for (occ in oCxnOccs) {
    oCxnDefs.push(Designer.getDefinition(oCxnOccs[occ]));  // save the CxnDefs for deletion later on
    Designer.deleteOcc(oModel, oCxnOccs[occ]);
}

Designer.save(oModel);   // now first save the model

for (def in oCxnDefs) {
    Designer.deleteCxnDefPersistent(oCxnDefs[def]);  // now delete the definition
}

Best regards,

Edwin

0
by Vladimir Bis Author
Posted on Tue, 01/17/2012 - 12:03

Hi Edwin,

thank you for feedback. One question - is it possible to remove connection occurence and retain connection definition? (in code)

And how is it possible to do it manually in model?

 

0
by Edwin Verstraeten
Posted on Tue, 01/17/2012 - 13:13

Hi Vladimir,

If you do not execute the Designer.deleteCxnDefPersistent the definition stays in the database. You can check this by selecting the object and check the relationships tab in the properties window. If you manually delete a connection in a model, the definition stays available at all time.

Of course if the connection is no longer used, the definition is removed upon reorganization.

Best regards,

Edwin

0
by Vladimir Bis Author
Posted on Wed, 01/18/2012 - 08:46

Hi Edwin,

why do you prefer macro methods to report methods?

0
by Edwin Verstraeten
Posted on Wed, 01/18/2012 - 09:58

Hi Vladimir,

There's a distinction between macros and reports. Reports run server side while macros run at client side. Beside this, macros can perform tasks on (by the client) opened models, where reports can't manipulate them. So if i need to do something on an opened model, i am forced to use the macro methods.

When working with the macro methods, note that the reports methods are not valid. You need to use the macro object model which is module based rather than object based.

Best regards,

Edwin

0
by Vladimir Bis Author
Posted on Wed, 01/18/2012 - 10:41

Hi Edwin,

I use macro in most cases when I need to catch any event. But I prefer report methods because of their richness - there are more methods on reports, I think.

And I try to avoid to do on an opened models, because some user can work on this.

 

0
by Edwin Verstraeten
Posted on Wed, 01/18/2012 - 11:47

Hi Vladimir,

I absolutely agree with your points here. But you can easily check whether the model is opened by you or not.

Use the Designer.getOpenModels() method to determine all models opened by the active user in the same client.

Use the Designer.isOpen() method to check whether the model is open or not,

If the model is opened and it's not in the getOpenModels list, then you are not the current user of the (opened) model, so you can't perform updates on it.

But in essence, you're right.

Best regards,

Edwin

0
by Vladimir Bis Author
Posted on Wed, 01/18/2012 - 12:32

Hi Edwin,

thank you, I completely forgot for method isOpen :)

0
by Vivek Ingle
Posted on Mon, 09/02/2013 - 08:47

HI  Mr Edwin Verstraeten,

firstly I created the model and object using script in selected group but i want 

to delete that model and object  without using database

Should I Close the model ?

how to do that?

Please help me.....

 

Thanks 

vivek 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

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