Aris Scripting Tutorial - Part 2 - Object Attribute Listing

by Mr. Volker Eckardt (2010-04-30) in group Reports & Macros in ARIS

Hello Community,

I think it is time now to start with the first data listing out of Aris Architect. You may have seen the Hello World, and already tried it. This time the number of commands will grow, but the main steps are the same.

What we are going to do is this listing, a plain list of main model attributes + attributes from selected object occurences. To run it, open a model of your choice, select one or many functions and run the report, You will get a list like this:

Now, let's start how to build this:

Step 1: Create, if not yet done, a new Category for your custom reports.

Step 2: Name it accordingly, to identify the content

Step 3: And begin now with a new report

Step 4: Fill in the Values for the Report definition

Step 5: Select the objects you are going to list in the report

Here we select Events and Functions.

Step 6: Choose the default Layout

Excel is not yet supported by this report, therefore we select plain text only (PDF, ...)

 

Continue with wizard step 4 and click on [OK]

Hint: If you select here "Enter source text (code view), then you can continue directly with step 9. In this case no layout will be created. Please make sure that you are selecting at least PDF as output type.

 

Step 7: Review the result.

The wizard assumes that you are going to create a report with layout, therfore some content data are already there, but ...

 

Step 8: Change to Script editor and remove the Content

... as we are going to create our own, we will remove everything.

That's the generated code:

Select everything and hit the [Delete] button.

Now press [save] and accept the warning.

Step 9: Now we are beginning to code

Usually a code starts with some constants. In this case it is a language constant (we need it to read the attribute names correctly). 

Below that we start immediately with the main function. In fact it will not be called here, but it will be defined. With the Context we define a handler for the outfile, set the format we are going to use and get a list of all selected objects.

If at least one object has been selected, we will continue and loop through this list. The current object we track in currObject.

To make the report a little bit more complete, we are reading some general values like the model name, the group etc. And also the current filter.

We will now print the selected data above immediately (to be precise: prepare for printing).

And will now take care about the object attributes itself. In this first part we list only maintained attributes. A custom function will provide this information. The print out is again a list.

In a second part we are printing the oposite, which means all not maintained attributes. You see this small ! in front, this will do the job for us.

A little bit of summary, and a final go for the report to write.

Below the closing "}" we have some helper functions. This simple function will determine if the attribute is maintained or not.

And the second will just define an output style.

 

Because the engine does not recognize the main function automatically, we have to call it here.

 

How to start?

Open a model, click on one or on multiple objects in it, and select "Evaluate" > "Start Report ...". Select your report category and let it run.

 

 

Final note:

This tutorial helps you to get a better understanding how JavaScript works inside ARIS. You may find easier or better solutions to provide the same - please use this community to share your thoughts. I am going to extend this first version step by step and will make it more complete.

Any kind of feedback is very welcome!

Download

Please download the report file from here

Next Article

In the next article we are going to change the output to Excel and will discuss special enhancements to get a nicer output.

Related Articles

Best regards

Volker


Comments

by Mr. Ahmad Fares (2010-05-12)

WOW

 

thank you very much , i have a question

i need a script can delete any object i selected , is there any script in ARIS do this ? if not , how i can do it ?

do you have this script ?


by Mr. Volker Eckardt (2010-05-12)

Hi Ahmad,

thanks for your question. I am not sure if I understand your question correctly. What kind of objects you like to delete? If you can select an object, why can you not delete it via "Delete"?

Regards, Volker


by Mr. Ahmad Fares (2010-05-12)

ok , becuse i need advance deletion options , like

delete with ocurence copies .

delete all object that belog to the current model (without using search option)

the idea is how yo can simplity the deletion process for the client , in one shot and in the design molule  delete for example the object that do not connected to any other objects for the current model(still opend) .

thank you


by Mr. Ahmad Fares (2010-05-12)

hi

al least , i just want the script command that delete the selected object

 

thanks


by Mr. Balaji Sundarababu (2010-05-13)

Hi Volker,

I need some help with the script template.....I have created a template but the problem is when i run a report i am getting only the Business Process flow EPC diagrams, but the report does not contain the value chain, KIP, function allocation diagram,

I have used the below script in the report template,

 

1 {Selected groups.Model list (filterable by type).Name}
{Selected groups.Model list (filterable by type).Graphic}

 

Please guide me.

 

Thanks,

Balaji


by Mr. Volker Eckardt (2010-05-13)

Hi Balaji,

thanks for your question. I assume your issue belongs rather to the wizard than to code? But if I understand you right, please enable the model types you like to report in the "context" window. You can also get into later by opening the properties for your report.

In section "context" review the checked model types and add additional if required (see also Step 5 above). 

Keep in mind that the JavaScript based reports here in the tutorial don't support model selection except from part 6 onwards. The wizard generated solution from part 3 can be enhanced with the given steps above to work with any model type and/or object type.

Hope this helps!

Best regards, Volker


by Mr. Balaji Sundarababu (2010-05-13)

Hi Volker,

 

Thank you so much for your response, i have already selected the model in the Context, please find the attached screen shot.

 

Not sure why my reports are coming like that, can i have your mail id so that i can send you the template.

 

Thanks,

Balaji


by Mr. Ludo Beckers (2010-06-16)

What happened here? The script has a "lock" on it, and I can't alter its contents anymore.

This happened after running the report; it went straight to this locked state instead of opening the report results (or error report).

Help appreciated :-) thanks.


by Mr. Volker Eckardt (2010-06-17)

Hi Ludo,

the lock will come automatically if you run the report in the code view or debug mode. Just hit the run button on top to let it go.

When the execution is over the output window (e.g. Excel or PDF, ...) should open and the lock should go away.

Hope this helps.

Volker


by Mr. Ludo Beckers (2010-06-17)

Hi Volker,

I understand, thank you :-)

Ludo


by Mr. Se Hyoung Yoo (2011-01-26)

Hi Volker,

I have executed this scrpt, but it takes no message like the above mentioned

==================================================
Database    = 
Language Id    =
Curr Filter Name = 

Model Name =
Model Group = 
Model Group Path = 
==================================================
Only I have got "Please select a valid object occurence! "

I need a help to get a real data like your list.

Thanks for your help. 


by Mr. Volker Eckardt (2011-01-26)

Hi Se Hyoung,

Well, this message tells you that you should select an object (function) and then via right-mouse -click run the report (see section "How to start?" above).

Have you done it like that?

Regards
Volker


by Ms. Sukanya Nagarajan (2011-08-23)

i found some error in Constants.AT_SYSTEM_TYPE . can anyone guide me , what value should i pass for that and where should i find that value