IBM Support

BIRT: Sorting data in reports based on specific criteria

Question & Answer


Question

How do you create a BIRT report in IBM Rational Software Architect/Modeler where UseCases are sorted based on a number entered in the Keyword field?

Cause

To generate such report you must know the following:

1. The keyword field can be accessed using the XPath expression:
eAnnotations/details/@key

2. Sorting in BIRT can be achieved by creating Groups inside Lists or Tables. See the Product Help page contained in: Eclipse documentation > BIRT Guide > Field Guide to BIRT > Sorting and Grouping Data > Tutorial 2: Grouping report data > Task 5: Group customer data by credit limit

Answer

Prepare the Model:

1. Create a new UML Model

2. Add a few packages and a few use cases in each package

3. Enter an integer number that indicates the desired ordering of the use cases in the report for each use case in Properties > Stereotypes > Keyword

Prepare the Report Data:

1. Create a new report based on the Blank Report Template

2. Add a new data source: UML Data Source

2.1. Add the above model as Instance Model to the Data Source

3. Add a new Data Set called: UseCasesWithKeyword




3.1. Press Next twice
3.2. Browse for the UML Metamodel in Row Mapping
3.3. Enter //UseCase in Expression
3.4. Select: uml:UseCase in Type



3.5 click Next
3.6 Browse for uml:UseCase in Column Mapping and then with the help of the button labeled >, enter the following column definitions:

NameQueryType
name@nameString
qualifedName@qualifiedNameString
namespace_namenamespace/@nameString
keyeAnnotations/details/@keyString



3.6 Click Finish and preview the results:




3.7 Click OK to close the Data Set Editor.

Prepare the Report Layout:

1. Insert a table linked to the UseCasesWithKeyword data set:




2. Insert a group (right click on the table and choose Insert Group)
2.1. Select qualifiedName (any field with unique values would be suitable) from Group on
2.2. Add the following in Sorting:
Sort KeySort Direction
row["key"]Ascending





3. Drag and drop the columns: "key", "namespace_name", "name" from the data set into the three cells of the Detail row of the Group.

4. Remove the label qualifiedName from the header of the group.

5. Customize the labels contained in the table header. Call them: "Order", "Namespace Name", "UseCase Name".

The resulting report will look like the following screenshot:


[{"Product":{"code":"SSCLKU","label":"Rational Software Modeler"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Reports","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.1;7.5.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4JE2","label":"Rational Software Architect Standard Edition"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Reports","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.1;7.5.2","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}},{"Product":{"code":"SS4JCV","label":"Rational Software Architect for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Reports","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.1;7.5.2","Edition":"","Line of Business":{"code":"LOB15","label":"Integration"}}]

Document Information

More support for:
Rational Software Modeler

Software version:
7.5, 7.5.1, 7.5.2

Operating system(s):
Windows

Document number:
625995

Modified date:
29 September 2018

UID

swg21384464

Manage My Notification Subscriptions