To calculate a measure or create a dimension, either the value of an existing attribute is used or the algorithm for calculation of the attribute is specified in the XML configuration file (calcattr XML element). The specified attribute name must be contained in the imported attribute definition for the PPM system (files AttributeTypes.xml and AttributeNames.xml). The data type and base unit are defined by the attribute definition. The calculation of an attribute is always made in the base unit of the attribute type. The result is also saved as a value in the base unit.
Attributes are only valid within a process instance. It is not possible to calculate attributes for other process instances or to include them in the calculation.
The calculation of an attribute can be made dependent on other attributes, which can themselves be calculated attributes. All attributes specified with the depends XML element are calculated before the calculation of the current attribute is executed. Cyclic dependencies are detected during import of the measure configuration and acknowledged by an error message.
A default value can optionally be specified (defaultvalue XML element), which can be assigned to the attribute value if the calculation could not be successfully carried out. The default value must always be specified with a unit that is permissible for the attribute data type. This is the only way for the value in the base unit to be calculated correctly.
If an attribute cannot be calculated and no default value is specified, the attribute is not created for the process instance or the process instance objects and a corresponding message is output.
The XML structure for definition of an attribute calculation looks like this:
...
<calcattr name="..." type="..." objectname="..."
scale="..." delete="...">
<depends attrname="..." type="..."/>
<defaultvalue>"..."</defaultvalue>
Either
<calculation> ... </calculation>
</calcattr>
...
or
<calcclass name="..."/>
</calcattr>
...
XML tag |
Description |
---|---|
name |
Internal name of the attribute to be calculated. |
type |
Object type to which the attribute is written PROCESS: Calculated attribute is written to the process instance. |
relname |
Only for type="RELATION". Specifies the relation to which the attribute calculation is to relate. To be used instead of dependsrel. |
objectname |
Internal name of the function (AT_OBJNAME_INTERN object attribute) to which the attribute is written. This option may only be used for the calculation of function attributes. Multiple object names are specified separated by commas, the placeholders * and ? can be used as required in the object name. |
scale |
The result of a calculation rule is written to the attribute in the specified scale. |
delete |
If the value is yes a previously calculated attribute value is deleted before the new calculation (e.g., specified for the definition of critical time attributes used by the Early alert system, see Time dimensions for the Early alert system chapter). Default value: no |
To selectively specify a calculation rule for one or more particular functions, specify the name of the corresponding function in the objectname XML attribute.
Example
The calculation rule is only executed for functions whose internal names match the specified pattern.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE keyindicatorconfig SYSTEM
'KeyindicatorConfiguration.dtd'>
<keyindicatorconfig>
...
<calcattr name="AT_END_TIME" type="OT_FUNC"
objectname="FCT_AUFT??_*,
FCT_END_*_?,
*_AUFTRAG,FCT_AUFTR_START">
<calculation>
...
</calculation>
</calcattr>
...
</keyindicatorconfig>
The definition of a calculation rule is completed by specifying the following XML elements:
XML element |
Description |
---|---|
depends |
Name and type of an attribute (PROCESS, OT_FUNC, OT_EVT, OT_ORG, or RELATION), which must exist for the calculation to be executed. If the specified attribute is a calculated attribute, this is calculated first. The relname attribute specifies the relation on which there is a dependency (only for type="RELATION"). |
dependsrel |
Name of the relation on which there is a dependency (only for type="RELATION"). To be used instead of relname. |
defaultvalue |
Default value of the attribute if the attribute cannot be calculated for whatever reason. |
calcclass |
Unique specification of the calculation rule using one of the two XML elements. |
calcparam |
Only for calcclass. Transfers any number of parameters (calcparam) when calling up a calculation class. The unique internal name of the parameter is defined using key and the corresponding parameter value using value. |
For calculating an attribute using the calculation XML element, a comprehensive set of rules for the definition of calculation rules is available.
Example
The example below shows the XML definition of the calculation of the processing time for a process instance. The processing time is defined as the difference between the earliest start time and the latest end time of all functions in a process instance. To store the measure value, the AT_KI_PROCESSTIME attribute (type: time span) is selected. The calculation is only to be carried out if the two attributes AT_START_TIME and AT_END_TIME are specified for at least one function of the process instance. This does not necessarily have to be the same function. If the calculation fails for any reason, the result attribute is assigned the default value of 0 SECOND.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE keyindicatorconfig SYSTEM
'KeyindicatorConfiguration.dtd'>
<keyindicatorconfig>
...
<calcattr name="AT_KI_PROCESSTIME" type="PROCESS">
<depends attrname="AT_END_TIME" nodetype="OT_FUNC">
<depends attrname="AT_START_TIME" nodetype="OT_FUNC">
<defaultvalue>0 SECOND</defaultvalue>
<calculation>
<minus>
<filteredattribute name="AT_END_TIME"
nodetype="OT_FUNC" filter="LATEST"/>
<filteredattribute name="AT_START_TIME"
nodetype="OT_FUNC" filter="EARLY"/>
</minus>
</calculation>
</calcattr>
...
</keyindicatorconfig>
A calculated attribute always contains the result value and the result unit. The result unit is always specified in the base unit corresponding to that in the data type of the event attribute.