This is an old revision of the document!


Creating Stages BIRT Reports: A Basic Example

This section explains how to create a basic BIRT report that extracts information from Stages.

Create a Report

  1. The BIRT RCP Designer is started by executing the birt.exe
  2. Select File –> New –> New Report from the drop-down menu
  3. Type the name for the report
  4. Select the path where the report file will be stored, and click Next
  5. Select Blank report, and click Finish

The new blank report will be opened on the right side.

Create a Data Set

  1. Navigate to the Outline View on the lower left side and right-click on Data Set and select New Data Set.
  2. Select a name for the Data Set, and click Next.
  3. Enter the column names and data types
    1. <font inherit/Courier New,Courier,monospace;;inherit;;inherit>Documentname</font>with type string
    2. <font inherit/Courier New,Courier,monospace;;inherit;;inherit>State</font>with type String
  4. Click Next.
  5. Click Edit Script
  6. Enter the following script into the editor
var artifacts =
pkit.getCurrentProject().getEntities("containsProcess@SYSTEM")
[0].getEntities("containsArtifact@SYSTEM");
for (i = 0; i <artifacts.length; i  ) {
 var artifacts_instances =
 artifacts[i].getEntities("containsInstance@SYSTEM");
 for (j = 0; j <artifacts_instances.length; j  ) {
 var artifacts_revisions =
 artifacts_instances[j].getEntities("containsRevision@SYSTEM");
 if (artifacts_revisions.length == 0) {
dataset.setColumnValue("State", "no version");
 } else {
 dataset.setColumnValue("State",
 artifacts_revisions[0].getProperty("state"));
 }
 dataset.setColumnValue("DocumentName",
 artifacts_instances[j].getProperty("LogicalName"));
 dataset.storeResultRow();
 }
}
  1. To finish the editing of the script, click OK.
  2. Enter a Current metric in the text input field. The current metric is the Stages path to an existing Stages metric element or workspace name combined with the metric name. You can see both ways in the example below. A metric element with the name “Example metric” in the project Company –> Projects and Products –> System A –> Software Project A.
    1. Note: The current metric value is needed for the preview, if the script contains the statement <font inherit/Courier New,Courier,monospace;;inherit;;inherit>pkit.getCurrentProject()…</font>
    2. Click Finish to continue the data set configuration and click Preview Results to show a preview of the results.

Create a Data Set

  1. Navigate to the Outline View on the lower left side and right-click on Data Set and select New Data Set.
  2. Select a name for the Data Set, and click Next.
  3. Enter the column names and data types
    1. <font inherit/Courier New,Courier,monospace;;inherit;;inherit>Documentname</font>with type string
    2. <font inherit/Courier New,Courier,monospace;;inherit;;inherit>State</font>with type String
  4. Click Next.
  5. Click Edit Script
  6. Enter the following script into the editor
var artifacts =
pkit.getCurrentProject().getEntities("containsProcess@SYSTEM")
[0].getEntities("containsArtifact@SYSTEM");
for (i = 0; i <artifacts.length; i++) {
 var artifacts_instances =
 artifacts[i].getEntities("containsInstance@SYSTEM");
 for (j = 0; j <artifacts_instances.length; j++) {
 var artifacts_revisions =
 artifacts_instances[j].getEntities("containsRevision@SYSTEM");
 if (artifacts_revisions.length == 0) {
dataset.setColumnValue("State", "no version");
 } else {
 dataset.setColumnValue("State",
 artifacts_revisions[0].getProperty("state"));
 }
 dataset.setColumnValue("DocumentName",
 artifacts_instances[j].getProperty("LogicalName"));
 dataset.storeResultRow();
 }
}
  1. To finish the editing of the script, click OK.
  2. Enter a Current metric in the text input field. The current metric is the Stages path to an existing Stages metric element or workspace name combined with the metric name. You can see both ways in the example below. A metric element with the name “Example metric” in the project Company –> Projects and Products –> System A –> Software Project A.
    1. Note: The current metric value is needed for the preview, if the script contains the statement <font inherit/Courier New,Courier,monospace;;inherit;;inherit>pkit.getCurrentProject()…</font><font inherit/Courier New,Courier,monospace;;inherit;;inherit></font>
    2. Click Finish to continue the data set configuration and click Preview Results to show a preview of the results.