Differences

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

Link to this comparison view

72:custom_reports_accessing_data_reading_process_attributes [2019/02/27 20:13]
ext-bkkr created
72:custom_reports_accessing_data_reading_process_attributes [2019/03/06 17:58] (current)
ext-bkkr
Line 1: Line 1:
 ====== Reading Attributes ====== ====== Reading Attributes ======
  
 +Stages allows to configure attributes in the metamodel.
 +
 +Assume that the following attribute types are configured in your PKitConfig.xml file:
 +
 +<​code>​
 + <​attributeTypes>​
 + <​attributeType ident="​important_type"​ type="​BOOLEAN"​ />
 + <​attributeType ident="​identifier_type"​ type="​STRING"​ />
 + <​attributeType ident="​phaseState"​ type="​SELECTION">​
 +   <​option ident="​future"​ defaultOption="​true"/>​
 +   <​option ident="​active"/>​
 +   <​option ident="​completed"/>​
 +   </​attributeType>​
 + </​attributeTypes>​
 +</​code>​
 +
 +and your metamodel configuration contains a process attribute like:
 +
 +<​code>​
 + <​processtype ident="​unified_configuration">​
 +  <​attributes>​
 +   <​attribute typeIdent="​phaseState"/>​
 + </​attributes>​
 +</​code>​
 +
 +1. Create a Report with a Stages Data Source and a Data Set
 +
 +2. Create a result column Attribute
 +
 +3. Copy the Data Set script from the example into your Data Set
 +
 +4. Set your current Metric to an existing metric in a Stages project
 +
 +This example shows:
 +
 +<​code>​
 +var process =
 + ​pkit.getCurrentProject().getEntities("​containsProcess@SYSTEM"​);​
 +if (process.length !=0 ) {
 + var attribute_values = process[0]
 + ​.getAttribute("​phaseState"​).getProperty("​databaseValue"​)
 + ​.toString();​
 + ​dataset.setColumnValue("​Attribute",​attribute_values);​
 + ​dataset.storeResultRow();​
 +}
 +</​code>​