YD

Hello community,

I am writing a report to get the link and the title of this link of a objet. In the next step the report should be able to edit the title of the link. Is there any example in the standards report?

Thanks in advance!

Best!

 

by Kay Fischbach
Posted on Mon, 01/21/2019 - 12:02

Hi there,

getting the link and title of a link isn't hard, they are attribute values like any other attribute value. You didn't say anything about the context of your report, so I'm assuming you're right clicking on an object occurrence in a model and starting the report from there. Should there be more to it than that... just tell me.

1. The foundation

When starting the report with the method described above, ARIS assumes you could have selected multiple object occurrences, therefore it puts all of the selected occurrences in an array. You get this array with the following method:

var p_selObjOcc = ArisData.getSelectedObjOccs();

Of course you only want to handle one object at a time (or maybe you only selected one occurrence to begin with), so you want to loop through this array and work with one object at a time. This is a standard Javascript loop.

for each (var oneSelObjOcc in p_selObjOcc){
    //more code goes here
}
2. The link value

Now that we are working with one object occurrence, lets work on getting the attribute value. You can chain the following commands together, so I'll explain it while extending the code-line. Basically what you want to do is find the object definition of the object occurrence that you selected

    oneSelObjOcc.ObjDef()

From there you want to find an attribute of the object, in this case the Attribute "Link 1". For the "Attribute(...)" method you need two parameters: first which attribute you actually want to get. This is an integer number, I'll explain later how you can find those numbers/substitute them with constants. Second the language number of the language in which the attribute value is maintained. You already set a language when you start the report with the wizard - we simply use that language with "Context.getSelectedLanguage()".

    oneSelObjOcc.ObjDef().Attribute(Constants.AT_EXT_1, Context.getSelectedLanguage())

The last thing you have to do is get the actual value of the attribute (so far we only told it to look for the attribute), and store it in a variable to use it in the future.

    var linkAttrValue = oneSelObjOcc.ObjDef().Attribute(Constants.AT_EXT_1, Context.getSelectedLanguage()).getValue();
3. The second attribute, the "Title 1"

Now for your second attribute, the title of the link: you'll continue writing code inside the loop, and it's basically the same thing up to a certain point.

    var linkTitleAttr = oneSelObjOcc.ObjDef().Attribute(Constants.AT_TITL1, Context.getSelectedLanguage());

As you can see, you want to follow the chain of commands until you reach the attribute. Save the attribute - from here on two paths are to take. You want to find the attribute value, just like we did before, and you want to modify the attribute value by setting a new value.

So the next two lines are

    var linkTitleAttrValue = linkTitleAttr.getValue(); //retrieve the attribute value
    linkTitleAttr.setValue("new Link title goes here"); //set a new attribute title
4. All together

Putting everything together, your report should look something like this:

var p_selObjOcc = ArisData.getSelectedObjOccs();

for each (var oneSelObjOcc in p_selObjOcc){
    var linkAttrValue = oneSelObjOcc.ObjDef().Attribute(Constants.AT_EXT_1, Context.getSelectedLanguage()).getValue();
   
    var linkTitleAttr = oneSelObjOcc.ObjDef().Attribute(Constants.AT_TITL1, Context.getSelectedLanguage());
    var linkTitleAttrValue = linkTitleAttr.getValue(); //retrieve the attribute value
    linkTitleAttr.setValue("new Link title goes here"); //set a new attribute title
   
}
5. Additional notes

I told you that this is basically the same scheme for every attribute. The only thing you have to change is the attribute number given to the "Attribute(...)" method as a parameter. You can find this number within the ARIS Architect software, if you have the "Configuration administrator" user privilege (you'll see whether you have it or not by following the following steps).

  1. Open the "Administration" tab within the ARIS Architect.
  2. In the left panel above "Evaluations" (where you find the reports) you can find "Configuration" - open "Configuration" (if you don't see "Configuration" you are missing the required user privilege. Contact a user that has the "User administrator" privilege and talk to them about it)
  3. Below "Configuration" open "Method" and there open "Attribute types"
  4. In the right panel you should now see a list of all attributes. Important for you are the "Name" column (obviously), the "Type number" column (you could use that number in the "Attribute(...)" method, but I would not recommend that), and the "API name" column (the API name allows you to get the number. When you switch ARIS versions the number may change, but the API name will always stay the same).

For standard attributes the API name will start with "AT_" and you can just put it behind "Constants." in your script to get the type number. If you have custom attributes it's a bit more tricky to look up the type number, but by far not impossible. You'll see a so called GUID number in the "API Name" column for that custom attribute. You can use this GUID number in the following method:

var attrNum = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("GUID_NUM_GOES_HERE");

Please also note that not all parameters are stored as strings. In the ARIS Script documentation under "Objects" you can find multiple object classes starting with "Attr" - take a look at those if you are interested in setting the value for attributes.

Should you have any additional questions, or want me to go a bit more in depth about something I wrote, feel free to ask.

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