Functionality introduced in this tutorial:
Additional Format Templates (Styles)
New Functions used like BeginTable, TableRow, TableCell, TableCellF ...
Different output handling in case Excel, HTML or PDF
Support for multiple sheets in one Excel file
Variable naming and comments now closer to ARIS Wizard standard
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.
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.
How to test?
As before, select one or many objects in your model and then Right mouse > Evaluate > Start Report ...