Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
72:custom_reports_getting_started_creating_reports [2019/02/15 19:54] – [Create a Stages Data Source] ext-bkkr72:custom_reports_getting_started_creating_reports [2019/02/15 20:06] ext-bkkr
Line 15: Line 15:
 ==== Create a Stages Data Source ==== ==== Create a Stages Data Source ====
  
-{{:72:birt_data_source_script.png?nolink&500x348}}+  - Navigate to the **Outline View**  on the lower left side and right-click on the **Data Source **entry and select **New Data Source**. 
 +  - Select **Stages Data Source**. Enter a name for the data source. 
 +  - Click **Next**. 
 +  - If you do not use the PkitMetrics.xml you need to specify the Stages server URL and enter a Stages username and password and click **Finish**. 
 +      - If you use the PkitMetrics.xml, it is necessary to insert a script for your Data Source. You will see the created Data Source in your BIRT Report Designer, click on Data Source and choose the "script tab" and the condition "beforeOpen" 
 +  - Insert the [[:72:custom_reports_getting_started_creating_reports_linked_script|linked script]] and save it.
  
-  - To create new Data Source, navigate to the **Outline View**  on the lower left side and right-click on the **Data Source**  entry and select **New Data Source**. +==== Create a Data Set ==== 
-  - Select **Stages Data Source**. Enter a name for the data source. In the examplethe default name is used.+ 
 +  - Navigate to the **Outline View**  on the lower left side and right-click on **Data Set **and select **New Data Set**. 
 +  - Select a name for the Data Set, and click **Next**. 
 +  - Enter the column names and data types 
 +      - <font inherit/Courier New,Courier,monospace;;inherit;;inherit>Documentname</font>with type string 
 +      - <font inherit/Courier New,Courier,monospace;;inherit;;inherit>State</font>with type String
   - Click **Next**.   - Click **Next**.
-  - If you do not use the PkitMetrics.xml you need to specify the <font inherit/Courier New,Courier,monospace;;inherit;;inherit>Stages server URL</font> and enter a <font inherit/Courier New,Courier,monospace;;inherit;;inherit>Stages username</font> (for example root) and <font inherit/Courier New,Courier,monospace;;inherit;;inherit>password</font>. Then click **Finish**. +  - Click **Edit Script** 
-      If you use PkitMetrics.xml, it is necessary to insert a script for your Data Source. You will see the created Data Source in your BIRT Report Designer, click on the Data Source and choose the "script tab" and the condition "beforeOpen".+  Enter the following script into the editor
  
-  - Insert the [[:72:custom_reports_getting_started_creating_reports_linked_script|linked Scripted]] and save it+<code> 
 +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(); 
 + } 
 +
 +</code>
  
 +To finish the editing of the script, click **OK**.
 +
 +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**.
 +  - //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>
 +  - Click **Finish**  to continue the data set configuration and click **Preview Results**  to show a preview of the results.
  
 ==== Create a Data Set ==== ==== Create a Data Set ====
  
-  - Navigate to the **Outline View** on the lower left side and right-click on **Data Set **and select **New Data Set**.+  - Navigate to the **Outline View**  on the lower left side and right-click on **Data Set **and select **New Data Set**.
   - Select a name for the Data Set, and click **Next**.   - Select a name for the Data Set, and click **Next**.
   - Enter the column names and data types   - Enter the column names and data types
Line 37: Line 73:
   - Enter the following script into the editor   - Enter the following script into the editor
       -       -
 +
 <code> <code>
 var artifacts = var artifacts =
Line 59: Line 96:
 } }
 </code> </code>
-  - To finish the editing of the script, click **OK**. + 
-  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**. +To finish the editing of the script, click **OK**. 
-      - //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> + 
-      - Click **Finish** to continue the data set configuration and click **Preview Results** to show a preview of the results.+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**. 
 +  - //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> 
 +  - Click **Finish**  to continue the data set configuration and click **Preview Results**  to show a preview of the results.