Configure Functions

You can create functions to define specific operations that aren’t available through built-in functions. In Oracle Integration, decisions created using the function notation return a value only when invoked from another decision.

To successfully invoke a function from another decision, the number and type of parameters in the function invocation must match those in the function definition.

Note:

Because a function decision by itself doesn’t return a result, it’s not an output decision. Therefore, you can’t add function decisions to a decision service.

To add a function decision to the canvas and define its properties, see Add Decisions.

Follow these steps to configure the decision's logic:

  1. Double-click the function node to access its logic editor.
    Alternatively, select the node, and click Edit or View Decision Logic icon on the sidebar.
  2. Add parameters to the function.
    1. Click Parameters ( ), and then click Add Parameter Add Parameter icon.
    2. Enter a name for the parameter and select a data type for it. See Data Types.
    3. Similarly, add as many parameters to your function as needed.
  3. In the Body field, define the function's logic using the parameters you added.
    1. Select the required notation for the Body field. Click Options icon, select Change Value, then select a notation from the available options.
      The field has the expression notation selected by default.
    2. Configure the logic for the selected notation using the parameters defined.
    3. Additionally, you can move or replicate the Body field's contents between decisions. Click Options icon and select the required action.
  4. To reuse the entire logic definition (including parameters) in another decision, cut or copy it and paste it into the desired decision. Click Options icon in the header and select the required action.
Changes you make within the decision model are automatically saved and validated. Errors and warnings, if any, are displayed in the editor. Click the error or warning icon to review and fix them. See Review and Fix Errors in a Decision.

The following example demonstrates a function implementation in Oracle Integration. Here, the function decision contains the logic for regular discounts in the form of a decision table. An output decision invokes the function decision to calculate the special discount percentage.

A function decision

The image shows a Function decision called Regular Discount. The function is divided into two sections, Parameters and Body. The Parameters section contains two entries and an Add Parameter button. The first parameter is named C, and the second parameter is named P. Both are of the type Number. The Body section of the function contains a decision table. The first row of the table contains the hit policy cell with the Any hit policy selected, an input header cell that has the variable C entered, another input header cell that has the variable P entered, and an output header cell. There is an Allowed Values cell within each header cell, with values set as Auto for inputs and as Any for the output. There are three rows that constitute rules of the table. Each row consists of the following: a cell indicating the rule number, two input entry cells, and an output entry cell. Values entered for each rule are: First rule: dash, >100, and 10; Second rule: >=50, dash, and 10; Third rule: <50, <=100, and 5.

An output decision invoking the function

The image shows an Expression decision named Special Discount. The value entered in the expression field is Regular Discount(Count,Price) + 100.