MA

I urgently need to write one macro :

The macro should not let user save the model if anything is changed in it (except creating one type of object). This means : the user (e.g "BANKUSER") should create only one object (e.g. SymbolNumb=999999) on EPC model and mustn't change anything else (attributes of objects or model, delete objects,  placement of occurences and etc.) If he changes other things the shouldn't be saved.

 

I am new to macros , can you help me with the task ?

 

 

Thanks.

by Vladimir Bis
Posted on Wed, 12/14/2011 - 15:10

Hi Misha,

for example - I disable model attributes.

So, create macro with event "Model attribute is to be changed by modeling (vetoable)". Use this code:

var m = Context.getSelectedModels();
if (Context.getLoginInfo(m[0]).getUserName() == "BANKUSER"){    
  Context.setProperty("event.veto", "1")
}

Open model attributes and try to change any - are disabled. So try other events, but in event name must be "(vetoable)".

0
by Misha Akopov Author
Posted on Thu, 12/15/2011 - 08:36

Mr. Vladimir Bis

 

Thanks it helped me very much !

0
by Vladimir Bis
Posted on Thu, 12/15/2011 - 09:09

Hi Misha,

I write you example, where I can create only event. You should select macro event "Object occurence created". There isn't vetoable event for creating occurence, so we have to delete occurence.

var oObjOccs = Context.getSelectedObjOccs();
if (Context.getLoginInfo(oObjOccs[0]).getDatabaseName() == "TEST" && Context.getLoginInfo(oObjOccs[0]).getUserName() == "BANKUSER"){    
  if (oObjOccs[0].getSymbolNum() != Constants.ST_EV){
    Designer.deleteOcc(Designer.getModel(oObjOccs[0]), oObjOccs[0]);  
  }
}

 

0
by Misha Akopov Author
Posted on Thu, 12/15/2011 - 10:57

Mr. Vladimir Bis

Thanks again. It also helped me. One more question , is it possible to use REPORT methods/functions in Macro ?

0
by Vladimir Bis
Posted on Thu, 12/15/2011 - 11:27

I think no, but you can call report from macro

0
by Misha Akopov Author
Posted on Fri, 12/16/2011 - 08:32

 

   The only problem in this great solution is that it slows down modeling. Our designers wait for the  macro (1 sec.)  to run before or after editing each attribute, creating new object , moving objects etc. And all this because of blocking one user :D They are angry :)))

0
by Vladimir Bis
Posted on Fri, 12/16/2011 - 09:14

Hi Misha,

yes, I understand you, this is slow. But maybe solution is configurate new method filter (for only one object) for this user. This user have to login with this filter and you need to use simple macro, check only delete objects and occurence placement.

 

0
by Misha Akopov Author
Posted on Fri, 12/16/2011 - 12:35

Mr. Vladimir Bis

 

       Can you write in more details ? If I create a new filter, with one object, the user will not be able to see whole model.... and wich macro should I use ?

 

thanks

0
by Vladimir Bis
Posted on Fri, 12/16/2011 - 13:29

Hi Misha,

ooops, I forgott that user have to see whole model... I'm sorry, filter isn't good solution.

0
by Misha Akopov Author
Posted on Fri, 12/16/2011 - 14:52

Mr. Vladimir Bis

yes that's problem....

Is there any way to make Macro-s active for one user ?

 

 

 

0
by Vladimir Bis
Posted on Fri, 12/16/2011 - 15:33

I think no... only check in macro, which user is login

0
by Misha Akopov Author
Posted on Mon, 12/19/2011 - 09:17

Mr. Vladimir Bis

Ok Thanks:)

 

Can anyone suggest other solution ?

 

 

 

 

0
by Edwin Verstraeten
Posted on Wed, 03/28/2012 - 18:10

Hi Mischa,

Didn't see your post until now. It's a common issue that running a macro takes a while and impacts the modelers work. That's why I usually only execute the macro on save (vetoable) or user triggered. One question I have about the limiting a user to model certain objects on the model. Do you mean in this case that the user is not allowed to place the occurrence at all (so also no reuse of existing) or is it not allowed to create new object definitions, but allowed to reuse existing.

In the first situation, working on the same model is no option. I would suggest to have separate models for the different purposes. If you have a derived modeltype you can limit the symbols to be used for the specific models. Using a report you can then generate a view containing the information of both other views (this however results in high school scripting knowledge).

If the second situation is the case, you can run a report checking on the creator of the objects with a signaling function.

Unfortunately I can't give you another option.

Best regards,

Edwin

0
by Misha Akopov Author
Posted on Thu, 03/29/2012 - 09:12

Mr. Edwin Verstraeten

 

Thanks for reply !

      In my case I have situation, where user should create only one type of Object-Risk Object (create definition or reuse it as occurence) and shouldn't create definitions/occurences , delete , replace, or do anything else with other types of object or connections.

Now I use one macro , that checks username  while deleting object. It doesn't slow down designers' working process

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