Create Functions

You can create functions to define specific operations that aren’t available through built-in functions. In Oracle Cloud Infrastructure Process Automation, 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.

The following example demonstrates a function implementation in Process Automation. Here, the output decision invokes a function decision to calculate the seasonal discount percentage. The function decision contains the logic for regular discounts in the form of a decision table.


Description of dmn-function-canvas.png follows
Description of the illustration dmn-function-canvas.png


Description of dmn-functions.png follows
Description of the illustration dmn-functions.png

To create a decision with the Function notation:
  1. Add a new decision element to the model.
    1. On the Diagram palette, under Decisions select Function, and drag it onto the canvas.
    2. Double-click the element to edit its logic. You can also edit the function's logic from the Decision Properties pane. Click the three dots on the element and select Edit to open the Decision Properties pane of the element. In the Decision Properties pane, click Edit Edit icon next to the Name field.
    A function with empty Parameter and Body fields is created, with the Expression notation selected by default for the Body field.
  2. Click the Parameter field, and then click Add Parameter Add Parameter icon to add a new parameter. Enter a name for the parameter and select a data type for it. See Data Types.
  3. In the Body field, click Change Value Change Value icon to change the logical notation. Select the required notation from available options.
  4. Configure the logic for the selected notation. Press Ctrl + Space to view a suggestion list. You can use input variables or built-in functions from the list to define the logic.
  5. Changes you make within the decision model are automatically saved and validated from time to time. Errors and warnings, if any, are displayed within the decision panel.