Profile picture for user rc01740

Hi,

I'm new to making macro's and reports.

I'm trying to make a macro on the event Object created, that fills in the attribute Id.

I could use some global variable, perhaps an attribute on the database, that keeps the number of the next Id.

I managed to make a macro and link it to the event Object created, that part works. But now I have to make the code so that it only creates an Id for the symbol Process, and I have to look for the global variable and put it in the attribute of that new object.

I think the code should be something like this:

var allObjects = Context.getSelectedObjects();
for (var i = 0; i < allObjects.length; i++){
 var symbol = allObjects[i].GETSYMBOOL;
     if(smbol = PROCESSYMBOOL){
      var NextNr = DATABASE.ATTRIBUUTVALUE + 1;
         var nID = "O.Proc." & NextNr.TOSTRING();
         Designer.setAttributePersistent(allObjects[i], Constants.AT_ID, nID, null);
    }
}

But I don't know it exactly. Can somebody help me to make it work?

Thank you!

by Torsten Haase
Posted on Fri, 10/26/2012 - 10:41

Hi Veerle,

first you have to differentiate, whether you really want the macro to be executed when an OBJECT is created or when an object occurrence is created.

If an object is created, it normally does not have an occurrence yet, so checking the symbol will not work.

But, if needed, this code will get an object's symbol(s!):

var objOccList = Designer.getOccs( allObjects[i] )

for(var j=0; j<objOccList.length; j++) {

    var nSymbol = Designer.getSymbol(Designer.getModel(objOccList[j]), objOccList[j])

}

The only symbol you can get from an object definition is the "default symbol" which is used as default, when the a new occ of this object should be placed in a model:

var nDefaultSymbol = Designer.getDefaultSymbol( allObjects[i] )

Same as attribute types, there are symbol types as constants, beginning with ST_.

There are 3 symbol types for process symbols. Try to find out the correct one or look it up in the configuration/filter:

ST_PRC

ST_PRCS_1

ST_PRCS_2

You find these constants in the ARIS Script help: ARIS Script -> Methods for macros and transformations -> Constants ->Metamodel constants -> SymbolTypeNum

All component objects and their methods can also be found in the help. See ARIS Script -> Methods for macros and transformations ->Global objects -> Macro component interfaces.

You'll find the most useful methods in the Designer component interface. This can also be used to read/write an attribute from your Database object:

var attr =Designer.getAttribute(database, Constants.AT_NAME, Context.getSelectedLocale())



I hope this helps. BR, Torsten

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