Thursday, August 4, 2022

Create a Decision model based on expressions | Process Cloud Service

Usecase: Here, we will create a decision model based on expressions and will expose as a REST service. 

Implementation Steps:

Oracle cloud Home >> Processes >> Decision models


This will land on graphical view.


Switch to list view 


Add input data



Add new decision 


Take Expressions


Add the expression.



Play app


Test




Creating a little complex expression with 2 input fields



Test



Expose as service




Activate


Similarly we can create decision models based on If Then else, Functions, Contexts, Lists, Relations, Loops and Decision tables.

Follow oracle docs to create with above ways:

https://docs.oracle.com/en/cloud/paas/integration-cloud/user-processes/model-decision-logic1.html


How to configure Hit Policy | Decision table | Process Cloud Service

  • The Hit Policy Indicator cell displays the hit policy selected for the table. 
  • The hit policy determines the output of a decision table from the output cells of matched rules. A rule is matched when all of its condition cells match the inputs of the decision table.

Based on the hit policy, Decision Model Notation (DMN) broadly groups decision tables into the following categories:
  1. Single Hit: A single-hit table returns the output of only one rule. Under the single-hit category, Process supports the following hit policies:

    • Unique (U) – Only one of the rules can match.

    • Any (A) – Multiple rules can match, but all matching rules must have the same output.

    • First (F) – Multiple rules can match; the output of the first rule that matches is returned.

    • Priority (P) – Multiple rules can match; the output value that has the highest priority is returned.

  2. Multiple Hit: A multiple-hit table returns the output of multiple rules. Under this category, the following hit policies are supported in Process:

    • Collect (C) – Multiple rules can match; outputs are returned as an arbitrarily-ordered list.

    • Collect Sum (C+) – Multiple rules can match; the sum of outputs is returned.

    • Collect Min (C<) – Multiple rules can match; the smallest output value is returned.

    • Collect Max (C>) – Multiple rules can match; the largest output value is returned.

    • Collect Count (C#) – Multiple rules can match; the count is returned.

When you create a new table, the Unique (U) hit policy is selected by default. 

To change the policy, click the Hit Policy Indicator cell and choose from the available options in the Hit Policy drop-down list. If rules within the table violate the selected hit policy, a warning is displayed within the decision.


Create OIC Decision model from Scratch | Expose the decision model as REST | Test the rest enabled decision model using post man | Process Cloud Service

Usecase: Here we will do the following:

  • Create a Decision model based on decision table.
  • Expose decision model as REST API.
  • Test the rest enabled decision model using post man tool 

We will fetch the Grade and Result based on Name, class and section details from the decision table.

Implementation steps:

Oracle Home page >> Processes >> Decision Models



Create >> Create a Decision model




Switch to list view


Add type definition 



Add the Input data with the created complex type definition.


Add new decision


There are several option we can use. Here we will use Decision table.


Click this "!" Sign to add/update the decision table.



Added 3 inputs and 2 outputs


Save and play app for testing.


Test with input data.


Output:


Expose the desion model as rest service.




Take the rest API URL and input payload json schema


Activate the changes.



Open post man and use the rest enabled URI and json payload and basic authentication.

Note: convert that json payload schema to json format using any online tool.



Output:


If no decision table rule dose not match, it will show the output as following:


Using this exposed rest API URL, we can call this decision model from OIC Integrations.


Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...