CB

I have a Jave script that creates a definition copy of an object then places occurrence copies in various models. I would like to be able to change the placement of an attribute for a specific occurrence copy without affecting the other copies.  My test code is below. var object_occ at the end of the script should contain the occurrence copy of the object. How do I specifically select the attribute and set the postition of the attribute relartive to the object occurence; again, without affecting the other occurrences? Thanks in advance for your help! 

// Get a selected model
var m = models[0];
// Object definitions are placed in at the group level so get the group ID of the selected model
var grp = m.Group();
// Set placement of the occurance copy on the canvas
var x = 150;
var y = 50;
// Specfiy the object number
var obj = 22
// Specify the symbol to use. Must be a valid symbol for the object. Look this up in the ARIS-> Admin -> Symbols table
var symbol = 335
// Create the definition copy
var j = grp.CreateObjDef(obj, "Created Object", nloc);
// Populate the attribure values as needed
j.Attribute(Constants.AT_NAME, nloc).setValue("Create_Object_Name");
j.Attribute(Constants.AT_DESC, nloc).setValue("This is a test of the text");
// Create an occurrence copy of the object in the model at the specified coordinates. The 'true' boolean indicates use the default attribute position.
var object_occ = m.createObjOcc(symbol, j, x, y, true);

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Thu, 08/31/2023 - 10:53

Hi Chuck,

well, the attribute placements are ALWAYS only relevant for the single object occurrence.

oAttrOcc = object_occ.AttrOcc(Constants.AT_NAME);

if (oAttrOcc.Exist()){

...

}

else{

oAttrOcc.Create(Constants.ATTROCC_TOPRIGHT, g_oFontStyle);

}

 

BR Robert

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
  • SS
  • MZ
  • Profile picture for user kbiront
  • Profile picture for user Tony Iliev
  • Profile picture for user amandeep.7.singh
  • 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