Oracle® Rules Palette Release 9.1.0.0.0 E15811-01

# Functions Defined as Rules

A function defined as a rule contains common calculations that can be broken out into logical pieces. Functions improve readability as the inputs and outputs are clearly defined. In addition, the majority of math variables used in a function do not need to be stored or used outside of the function. The math variables in a function are not stored in Math results, which improves system performance. Instead, the function is cached temporarily.

Functions Defined as Rules

- All math functionality available in transactions and business rule configuration is available within functions except LOG. You can LOG the function’s return value, but you cannot LOG math variables in the function itself.

- Functions must be global and cannot call a Non-Global function or CopyBook.

- Functions are often chosen over CopyBooks for specific calculations since they offer increased readability.

- If a function is used multiple times in a transaction/business rule it will be resolved and compiled once, no matter how many times it is used in that transaction/rule.

Important: Existing functions are stored in the Global Rules Explorer window under the function folder type. You can view a function's inputs and return value by double-clicking the function's XML file. In the XML source, you will see the return value as an attribute of the function tag and pre-fixed with r for return. The inputs of the function are in the parameter tag and pre-fixed with p for parameter.

Steps to Call a Function Defined as a Rule

1. Right-click on the XML file that you want to call the function in.

2. Select Check out.

3. Open the Math pane.

4. From the Palette window, scroll down to the folder labeled rule and drag and drop FunCall onto the Configuration Area.

Note: If you do not see the Palette window on the screen, you can open it by selecting Open Search Palette Window from the Window option on the main menu.

5. Name the math variable.

6. Click the Data Type field to select a data type from the drop down box.

7. Select whether to LOG or Round the function’s output result.

8. Click the Functions field to select the function to call from the Functions drop-down box.

9. In the Input section, click the Value drop-down box to select each parameter’s value.

10. In the Output section, click the Value drop down box to select each parameter's value.

11. Check-in the XML file to save the changes.

Note: If the function’s parameters are set-up incorrectly in the function, you will see a red error in the bottom math variable text box.