Profile picture for user Volker Eckardt

Hello Community,

Ready for the next tutorial? This time I'd like to introduce the way how ARIS JavaScript handles Excel output.

Functionality introduced in this tutorial:

  1. Additional Format Templates (Styles)
  2. New Functions used like BeginTable, TableRow, TableCell, TableCellF ...
  3. Different output handling in case Excel, HTML or PDF
  4. Support for multiple sheets in one Excel file
  5. Custom Arrays
  6. Variable naming and comments now closer to ARIS Wizard standard
  7. optional: Fixed output file name possible

Whereas the data are similar to the previous tutorial (see Part 2), we are now going to create an output like this:

In fact it is not only Excel, also the HTML output can be enabled for your report - you know where to define this?

Additionally I am going to bring up a warning if someone selects PDF, so just enable PDF also please.

 

Now we will enhance our JavaScript code!

Step 1: Additional Style Definitions

We will have this function still on the end of our script, and will just add some more lines here.

Step 2: Constants

Now we are moving up and add some more constants here. There are two different types, arrays to hold the sub table headers and widths, but also two boolean variables to enable or disable certain code sections.

Step 3: Fixed Excel File Name

Let me introduce an option how you can define a fixed file name for dedicated types. If the constant in line 28  would be set to true, the file name will always become the report name itself (and no more the generic name).

The needed code is this:

In all other cases we use the default file name. Please look up other Constants like OUTEXCEL in the Script help.

Hint: To enter the needed help quickly, select the word createOutputObject, press F1 and choose the corresponding parameter set (in our case the second would be right). The upcoming help screen tells you exactly what Constants you can use additionally.

Step 4: HTML Page Title handling

To get this title in a html output (window and tab title) ...

... we add one more statement right here:

Step 5: PDF Error handling and first Table commands

Our code does not yet support PDF. To handle this, we add a warning in case someone starts it in PDF mode:

Then we open the table writing (line 83).

Regarding the 4 last lines: The first Excel cell in the output shows the title in light brown. This title spans over 2 cells. Because the PDF generator does not support this kind of format, we need to add another "if" statement here.

Step 6: Repeating Code Lines

You may now add lines for the model information. As we can see, there are always the same lines to fill one single cell.

A better approach would be creating a separate function and handle these 3 lines there:

Finally our model information section looks like this, much more compact and easier to maintain:

Step 7: Write the maintained Attributes

This section will always appear. We use now the two defined arrays, and the additional styles.

Only in case we are not in PDF mode, we are closing the table here. In case of Excel this EndTable will close the first sheet.

Step  8: Handle not maintained Attributes

If you like to get also a table with not maintained attributes, please set the constant from line 26 to true. All other code lines are quite similar to Step 7.

Step 9: Handle general Errors

Now, because we support Excel, our error handler should also use the table commands.

That's it!

 

How to test?

As before, select one or many objects in your model and then Right mouse > Evaluate > Start Report ...

 

Download

Please download the report file from here

Next Article

In the next article we will further enhance the code and will utilize the String Table to support multilanguage (see Tutorial Part 5).

Related Articles

Best regards

Volker

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