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
Last revisionBoth sides next revision
72:custom_reports_getting_started_creating_data_collector [2019/02/27 17:23] – [Create a Data Collector] ext-bkkr72:custom_reports_getting_started_creating_data_collector [2019/02/27 17:39] ext-bkkr
Line 3: Line 3:
 ==== Create a Data Collector ==== ==== Create a Data Collector ====
  
-  - Log into Stages as a user different to the //superuser//  (administrator). +  - Log into Stages as a user different to the superuser (administrator). 
-      - The User needs at least RMC permissions of the domain //Reports //and //Data Collectors// +      - The user needs at least (RMCpermissions of the domain Reports and Data Collectors. 
-        - //Note: Otherwise you cannot get the Data collector runningbecause the Data collector is running in the context of the user who saved the collector the last time. For security reasons the superuser context is disabled.// +      - //Note: Otherwise you cannot get the Data Collector running because the Data Collector is running in the context of the user who saved the collector the last time. For security reasonsthe superuser context is disabled.// 
-  - Select your metric in the Processes Application in Stages where you want to add a Data collector+  - Select your metric in the Processes Application in Stages where you want to add a Data Collector
-  - Select the Data Collectors tab, click on the **+**  sign to add a new Data collector+  - Select the Data Collectors tab, click on the **+ SIgn** to add a new Data Collector
-  - Enter a <font inherit/Courier New,Courier,monospace;;inherit;;inherit>name</font>for this Data collector and click on the **Script **tab. +  - Enter a name for this Data Collector and click on the **Script** tab. 
-  - Click the **More**  button to enter the first column name "DocumentName" and continue with the others. +  - Click the **More** button to enter the first Column name "DocumentName" and continue with the others. 
-  - Enter a data collector script +  - Enter a data collector script.
-      -+
  
 <code> <code>
-**var**  artifacts = +var artifacts = 
-<font inherit/inherit;;#2980b9;;inherit>pkit</font>.<font inherit/inherit;;#c0392b;;inherit>getCurrentProject</font>().<font inherit/inherit;;#c0392b;;inherit>getEntities</font>("<font inherit/inherit;;#2980b9;;inherit>containsProcess@SYSTEM</font>") +pkit.getCurrentProject().getEntities("containsProcess@SYSTEM"
-[<font inherit/inherit;;#2980b9;;inherit>0</font>].<font inherit/inherit;;#c0392b;;inherit>getEntities</font>("<font inherit/inherit;;#2980b9;;inherit>containsArtifact@SYSTEM</font>"); +[0].getEntities("containsArtifact@SYSTEM"); 
- +for (i = 0; i <artifacts.length; i++) { 
-**for ** (i = <font inherit/inherit;;#2980b9;;inherit>0</font>; i <<font inherit/inherit;;#2980b9;;inherit>artifacts</font>.<font inherit/inherit;;#c0392b;;inherit>length</font><font inherit/inherit;;#2ecc71;;inherit>i++</font>) { +var artifacts_instances = 
-**var **artifacts_instances = + artifacts[i].getEntities("containsInstance@SYSTEM"); 
- artifacts[i].<font inherit/inherit;;#c0392b;;inherit>getEntities</font>("<font inherit/inherit;;#2980b9;;inherit>containsInstance@SYSTEM</font>"); +for (j = 0; j <artifacts_instances.length; j++) { 
-**for ** (j = <font inherit/inherit;;#2980b9;;inherit>0</font>; j <<font inherit/inherit;;#2980b9;;inherit>artifacts_instances</font>.<font inherit/inherit;;#c0392b;;inherit>length</font>; <font inherit/inherit;;#2ecc71;;inherit>j++</font>) { + var artifacts_revisions = 
- **var **artifacts_revisions = + artifacts_instances[j].getEntities("containsRevision@SYSTEM"); 
- artifacts_instances[j].<font inherit/inherit;;#c0392b;;inherit>getEntities</font>("<font inherit/inherit;;#2980b9;;inherit>containsRevision@SYSTEM</font>"); +if (artifacts_revisions.length == 0) { 
-**if ** (<font inherit/inherit;;#2980b9;;inherit>artifacts_revisions</font>.<font inherit/inherit;;#c0392b;;inherit>length</font>== <font inherit/inherit;;#2980b9;;inherit>0</font>) { + dataset.setColumnValue("State", "no version"); 
- <font inherit/inherit;;#2980b9;;inherit>dataset</font>.<font inherit/inherit;;#c0392b;;inherit>setColumnValue</font>("<font inherit/inherit;;#2980b9;;inherit>State</font>", "<font inherit/inherit;;#2980b9;;inherit>no version</font>"); + } else { 
- **else **+ dataset.setColumnValue("State", 
- <font inherit/inherit;;#2980b9;;inherit>dataset</font>.<font inherit/inherit;;#c0392b;;inherit>setColumnValue</font>("<font inherit/inherit;;#2980b9;;inherit>State</font>", + artifacts_revisions[0].getProperty("state"));
- artifacts_revisions[<font inherit/inherit;;#2980b9;;inherit>0</font>].<font inherit/inherit;;#c0392b;;inherit>getProperty</font>("<font inherit/inherit;;#2980b9;;inherit>state</font>"));+
  }  }
- <font inherit/inherit;;#2980b9;;inherit>dataset</font>.<font inherit/inherit;;#c0392b;;inherit>setColumnValue</font>("<font inherit/inherit;;#2980b9;;inherit>DocumentName</font>",+ dataset.setColumnValue("DocumentName",
  artifacts_instances[j].getProperty("LogicalName"));  artifacts_instances[j].getProperty("LogicalName"));
- <font inherit/inherit;;#2980b9;;inherit>dataset</font>.<font inherit/inherit;;#c0392b;;inherit>storeResultRow</font>();+ dataset.storeResultRow();
  }  }
 } }
 </code> </code>
  
-  - Click on the **Save** +Click on **Save** 
-  Click on the **Preview**  tab to see a preview on the results+ 
-  - Click on the **Script **tab and click **Save**  to store the Data collector.+Click on the **Preview** tab to see a preview on the results.
  
 +Click on the **Script **tab and click **Save**  to store the Data collector.
  
 ==== Add a Collection Interval ==== ==== Add a Collection Interval ====
  
-  - Click on the Data Collector to get the context menu and select **Add collection** interval.+  - Click on the Data Collector to get the context menu and select **Add collection**  interval.
   - Enter the cron expression.   - Enter the cron expression.
   - Click Save to store the interval.   - Click Save to store the interval.