IBM Support

Obtaining and using data model information to customize a BIRT report design

Question & Answer


Question

How can users obtain the data model information that they need to customize their BIRT report designs?

Answer

Table of Contents

=============================================================


How to obtain alias information for your BIRT report design. 1
How to obtain primary key information for your BIRT report design. 13
How to obtain a column which has primary key as a true/false value. 23


How to obtain alias information for your BIRT report design

This document will guide you through the process of how to add alias information to a BIRT report design.

1. Ensure that there is at least one alias in the physical model.

2. Click on Window > Show View > Other.

3. Expand the Reporting node and double-click Report Explorer to open the view.

4. Double-click Physical Data Model Report to open its report design.

5. In the Data Explorer, expand the Data Sources node, right-click the Data Source node and select Edit to edit the data source.

6. Click the Add button to add a data source.

7. Click Browse Workspace to add an existing model as a data source.

8. Expand the Miscellaneous Data Models node, highlight Database Model.dbm and click OK. In the Load Resource window, click OK again.

9. You should see the data model in the list of EMF data instances. Click OK.

10. Right-click the Data Sets node and select New Data Set to create a new data set.

11. Enter Alias in the Data Set Name and click Next.

12. Ensure that the Use the data instances defined in data source check box is selected, and click Next.

13. Expand the db2 node, highlight the DB2Alias > Table node and click the right arrow (>) button.

14. Enter instanceOf(//*, “DB2Model:DB2Alias”) as the XPath expression to select all aliases. Ensure that the Automatically select the Type (in the 'Type' Combo control) check box is selected, and click OK.

NOTE: Please enter the XPath manually.

15. Click Validate XPath to ensure that the XPath expression is valid. Click Next.

16. Highlight the name:EString node in the EMF Structure tree and click the right arrow (>) button.

17. Enter Name in the Column Name field and click OK.

18. Click the Preview button and the name of the aliases in the model should appear.

19. Repeat step 16 and 17 to add description, aliased table name, schema name and label one at a time.

20. The Column Mapping view should now look like this. Click OK to exit the wizard.

21. In the Data Explorer view, Alias data set fields should appear under the Data Sets node.

22. Drag and drop the Alias Name onto the report design.

23. Click the Preview tab to preview the report.

24. At the bottom of the report, the name of the alias should be displayed.

25. Click the Layout tab to go back to the layout view. Highlight the alias name and delete it.

26. Drag and drop a Table object from the Palette view onto the end of the report design. Enter 5 when prompted for the number of columns.

27. With the table highlighted, change the width to 82%. Any width bigger than 82% will be cutoff in the print out.

28. Highlight the first two rows of the table by holding the Shift key and left mouse click on the cells of the first two rows. Click the Border node in the Properties view. Change the width and click on all four buttons for borders.

29. Drag and drop the fields onto the second row of the table one at a time.


30. The table should now look like this:

31. With the table highlighted, click the Visibility tab in the Properties area and enter the information as shown below. This step makes the table invisible if there is no alias in the report design.


How to obtain primary key information for your BIRT report design.

This section will guide you through the process of how to primary key information to a BIRT report design.

1. First ensure that there is a primary key in the data model. In the example below, the primary key owns three columns.

2. Click Window > Show View > Other.

3. Expand the Reporting node and double-click Report Explorer to open the view.

4. Double-click Physical Data Model Report to open its report design.


5. In the Data Explorer, expand the Data Sources node, right-click the Data Source node and select Edit.

6. Click the Add button to add a data source.


7. Click Browse Workspace to browse to and add an existing model as a data source.

8. Expand the Miscellaneous Data Models node, highlight Database Model.dbm and click OK. In the Load Resource window, click OK again.

9. You should see the data model in the list of EMF data instances. Click OK.


10. Right-click the Data Sets node and select New Data Set to create a new data set.

11. Enter Primary Key in the Data Set Name field, and click Next.


12. Ensure that the Use the data instances defined in data source check box is selected, and click Next.

13. In the Table mapping view, expand the sqlmodel node and the constraints node, highlight PrimaryKey > UniqueConstraint and click the right arrow (>) button.

14. Enter instanceOf(//*, “SQLConstraints:PrimaryKey”) as the XPath expression to select all primary keys. Ensure that the Automatically select the Type (in the 'Type' Combo control) check box is selected, and click OK.

NOTE: Enter the XPath statement manually.

15. Click Validate XPath to verify that the XPath expression is valid, then click Next.

16. In the Column mapping view, highlight name:EString and click the right arrow (>) button.

17. Enter Name in the Column Name field and click OK.

18. Click the Preview button and the name of the primary key in the model should appear in the Table Preview grid. Click Finish and OK to exit the wizard.


19. Repeat step 10 and 11, entering Primary Key Column as the name this time, then repeat step 12.

20. In the Table mapping view, expand the sqlmodel node, the constraints node, and the PrimaryKey > UniqueConstraint node. Highlight members : Column and click the right arrow (>) button.

21. Enter instanceOf(//PrimaryKey/members, “SQLTables:Column”) as the XPath expression to select all primary key columns. Ensure that the Automatically select the Type (in the 'Type' Combo control) check box is selected, and click OK.

NOTE: Enter the XPath statement manually.

22. Click Validate XPath to verify that the XPath expression is valid, then click Next.

23. In the Column mapping view, highlight name:EString and click the right arrow (>) button.

24. Enter Name in the Column Name field and click OK.

25. Click the Preview button, and the name of the primary key in the model should appear in the Table Preview grid. Click Finish and OK to exit the wizard.


26. Now you have two new data sets that represent the primary key and the primary key columns, respectively.


How to obtain a column which has primary key as a true/false value.

This section guides you through the process of adding primary key information to a BIRT report design.

1. Ensure that there is a primary key in the data model. In this example, the primary key owns three columns.

2. Click Window > Show View > Other.

3. Expand the Reporting node and double-click Report Explorer to open the view.

4. Double-click Physical Data Model Report to open the report design.


5. In the Data Explorer, expand the Data Sources node, right-click Data Source and select Edit .

6. Click the Add button to add a data source.


7. Click Browse Workspace to add an existing model as a data source.

8. Expand the Miscellaneous Data Models node, highlight Database Model.dbm and click OK. In the Load Resource window, click OK again.

9. The data model should appear in the list of EMF data instances. Click OK.


10. Right-click the Data Sets node and select New Data Set.

11. Enter Primary Key in the Data Set Name field, and click Next.

12. Ensure that the Use the data instances defined in data source check box is selected, and click Next.

13. In the Table mapping view, expand the sqlmodel node and the constraints node. Highlight PrimaryKey > UniqueConstraint and click the right arrow (>) button.

14. Enter instanceOf(//*, “SQLConstraints:PrimaryKey”) as the XPath expression to select all primary keys. Ensure that the Automatically select the Type (in the 'Type' Combo control) check box is selected, and click OK.

NOTE: Enter the XPath statement manually.

15. Click Validate XPath to verify that the XPath expression is valid, and click Next.

16. In the Column mapping view, highlight name:EString and click the right arrow (>) button.

17. Enter Name in the Column Name field, and click OK.

18. Expand the members node, highlight name:EString, and click the right arrow (>) button. Enter Column in the the Name cell and click OK.


19. Click the Preview button and the name of the primary key and the column that has the primary key constraint should appear. Click Finish and OK to exit the wizard.

20. Right-click the Data Sets node and select New Joint Data Set.

21. Select Column in the Define Joint Data Set list. This wil be the first data set.

22. Select Primary Key from the list as the second data set.

23. Select Name for the Column data set and select Column for the Primary Key data set to join them. Select Left Outer Join as the join type. Enter Column-Primary KeyJoint in the Data Set Name field, and click Finish.


24. Select the Computed Columns node and click New.


25. Enter IsPrimaryKey in the Column Name field, and click the ellipsis […] button.

26. Enter a script as shown in the screen shot. Click OK, and click OK again.

27. Click the Preview Results tab. The columns and their corresponding isPrimaryKey value should appear.

[{"Product":{"code":"SSSRXA","label":"Rational Data Architect"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Web Publisher","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.0.0.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21304879