Filter Elements in Report Template Development
When generate report with a report template, all the model/ diagram elements in the project that match the template definition will be generated to the report. But in some case, you might want to filter out some elements in the generated report. In this tutorial, you will learn how to define report template and filter out elements by element name, by stereotype and by project management properties.
Filtering by element name
- Download ATM.vpp from this tutorial
- Open the use case diagram of the project with VP-UML.

- Let's generate a PDF report with use case diagram. Select Doc > Generate PDF Report... from the toolbar.

- In the Generate PDF dialog box, select <New> from the drop-down menu of Template.

- Create a template and name it as Filter by name.

- Click Add Diagram Loop button.

- Select Use Case Diagram from the list on the right-hand side of the dialog box.

- From the diagram loop, click Add Element Loop button.

- Select Use Case from the list on the right-hand side of the dialog box.

-
From the element loop, click Add Property Value button. Select Use Case ID from the list of properties.
Similarly, click Add Property Value button from the element loop and then select Documentation from the list of properties.
- Click Element Loop (Use Case). Click on the green right button of Use Case. Uncheck balance, Donate money to charity, Pay bills, Login, Handle invalid password and Handle abort to ignore them during report generation.

- After finished editing, save the template by clicking Save button on the toolbar.

- Click Close at the bottom right corner of the dialog box.
- In the Generate PDF dialog box, specify an output path and click Generate at the bottom of dialog to generate a report.

- The following image shows the generated report. Only Withdraw cash use case and Transfer money use case re generated.

Filtering by stereotype
-
Let's specify process stereotype to use case. Right click on the Check balance use case and select Stereotypes > process from the pop-up menu.
After that, specify Process stereotype for Pay bills use case. The resulting use case diagram is as follow:
- After defining diagram and elements in report template, you can filter those use cases you don't want them to be generated by their stereotype. Click Element Loop (Use Case) and then uncheck all stereotypes, except process.

- The following image shows the generated report. Only Check balance use case and Pay bills use case with Process are generated.

Filtering by project management properties
- Let's assign priority to Withdraw cash use cases. Right click on Withdraw cash use case and select Open Specification... from the pop-up menu.

- In the Use Case Specification dialog box, open Project Management tab. Select High from the combo box of Priority.

-
Repeat the steps to assign priority for other use cases in the diagram:
| Use Case |
Priority |
| Check balance |
Medium |
| Donate money to charity |
Low |
| Transfer money |
Medium |
| Pay bills |
Medium |
| Login |
High |
| Handle invalid password |
Low |
| Handle abort |
Low |
- After defining diagram and elements, you can keep filter the use cases you want to generated in report by their priority. Let's generate report only for use cases with high priority. Click Element Loop (Use Case). Click the Add button under Project Management Filter section.

- Select Priority from the pop-up menu.

- Select High from the combo box of Priority.

- The following image shows the generated report. Only Withdraw cash use case and Login use case with high priority are generated.

Resources
- ATM.vpp
Rate this Article
Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).
One Moment Please
Thanks for rating this article.
Comments (0)