Define complex partial calculations for calculation rules that you want to use in several attribute calculations to be used as calculation functions. A calculation function is used by calling up usefunction in the calculation rule for an attribute calculation or calculation function.
Warning
When calling up calculation functions from other calculation functions, avoid cyclic dependencies. The import of this kind of measure configuration is canceled and an error message is output.
XML tag |
Description |
---|---|
function name |
Internal name of the calculation function. Referenced in the function call. |
Resulttype |
Result type (for use with other operators). Valid values: |
Datatype |
Data type of calculation result |
Usefunction |
Function call |
When defining and calling up a calculation function, the result type (resulttype) and data type (datatype) must also be specified.
Example
The following example shows the definition of the getPrincipal calculation function, which returns a value with the TEXT data type as the result.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE keyindicatorconfig SYSTEM
"KeyindicatorConfiguration.dtd">
<keyindicatorconfig>
...
<function name="getPrincipal" resulttype="VALUE"
datatype="TEXT">
<if>
<exists>
<attribute name="AT_PRINCIPAL_NAME"
nodetype="PROCESS"/>
</exists>
<then>
<max>
<attribute name="AT_PRINCIPAL_NAME"
nodetype="PROCESS"/>
</max>
</then>
<else>
<max>
<attribute name="AT_PRINCIPAL_ID"
nodetype="PROCESS"/>
</max>
</else>
</if>
</function>
...
</keyindicatorconfig>
Call up the calculation function
The getPrincipal calculation function previously defined is called up in the calculation rule for the AT_EXP attribute with usefunction. The result type for the calculation function must match the processing operator. In the example the syntactically correct result type VALUE is combined with the eq operator that processes values.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE keyindicatorconfig SYSTEM
"KeyindicatorConfiguration.dtd">
<keyindicatorconfig>
...
<calcattr name="AT_EXP" type="PROCESS">
<calculation>
<if>
<eq>
<usefunction name="getPrincipal"
resulttype="VALUE" datatype="TEXT"/>
<constant>
<dataitem>
KTD
<datatype name="TEXT">Text</datatype>
</dataitem>
</constant>
</eq>
<then>
...
</then>
...
</if>
</calculation>
</calcattr>
...
</keyindicatorconfig>
Create calculation functions using PPM Customizing Toolkit. In the Calculated attributes menu for the Measures and dimensions module, call up the dialog box for creating, editing and deleting calculation functions using the Configure calculation functions button. If calculation functions are specified in the system, they are available in the Define calculation rule dialog box both for the definition of additional calculation functions and for the definition of attribute calculations.