Making a function traceable
Because functions use Java code, there are no referencing rules, so you lose traceability when you call a function. To accommodate this restriction, you can map one or more of your input parameters to key parts of a specific rule type. Defining these associations supports traceability by updating the referencing rules for each collection that calls your function.
Example
The following example defines a reference between the CodeID function parameter and a Rule-PendCode rule instance, and instanciates it at run time:
-
Create the AddPendCode function with an input parameter that is named CodeID.
-
Map the CodeID parameter to the name key part of the Rule-PendCode class.
-
Create the ProcessPendCodes collection that calls the AddPendCode function and passes 17 as the CodeID value.
-
Open the tracer and process the collection. The tracer shows a reference between the ProcessPendCodes collection and the instance of Rule-PendCode named 17.
Setup
To map an input parameter to a rule type (step b in the example above), complete the following steps:
-
In the Function rule form, on the Parameters tab, in the Rule type parameters section, click the Add a row icon.
-
In the Rule type field, select the fully qualified class name of a Rule- class that has a category defined.
-
The Key name column lists one or more names that correspond to the key properties on the General tab of your selected class. For each Key name, you can enter a Key value.
- If the key property corresponds to an input parameter, enter the name of the input parameter preceded by a period, for example, .param1.
- If the key property can be treated as a constant, enter a string value, for example, ABC.
- You do not have to specify the Applies to key property, because at run time the system uses the step page of the calling rule.
-
Click Save.