Leading on from the previous post -

There are a couple of more goodies in the Decisions pack.

then with a large order...

Very succinct and easy to use.

Now did you understand the above?

Let's make it a bit more tangible. Here is my list, containing 5 products.

Lists can be referenced in Decision Tables -

Here I am setting the discount to the sum of the entries in the Product List.

Think of a DB table e.g. Products relation

So now to a simple test - using the Decision table from the previous post -

Line 6 makes no functional sense, but demonstrates how one can leverage

relations in a DT.

I will enter an order for 123 items with a total value of 12000.

As this has a hit policy of C+ we should get a final discount based on the

values for the 3 rules which will fire (Rules 4,5,6) so that is

16+25 + price of the iBike, 1300 = 1341

Test -

**Again, text taken from the Oracle docs in***italics*.There are a couple of more goodies in the Decisions pack.

### Contexts

*A context is a collection of one or more key-value pairs with an optional result field.*

*Each pair is called a context entry. The key attribute within a context entry acts as an*

*identifier to its corresponding value attribute.*

*You can use a context to collectively document all decision logic related to a particular*

*scenario or entity. Say you need to determine the loan eligibility of an applicant, based*

*on the applicant’s net monthly income and expense. For this purpose, you can create*

*a decision named Loan Eligibility using the Context notation and add expressions or*

*logic for gross monthly income, monthly expense, and net monthly income. Then, you*

*can either add a result field (within the context) that evaluates the net income and expense*

*for loan eligibility, or you can choose to evaluate these within another decision.*

Ok, so let's try this out, based on our Order payload -

I can now test this -

first with a small order...

then with a large order...

Very succinct and easy to use.

**Contexts**can be referenced from Decision Tables -### Lists

*A list notation is a vertical list of elements, where each element is an independent logical*

*notation. The output of a list notation contains outputs of all its elements. You can*

*also invoke the output of a particular list element from another decision.*

Now did you understand the above?

Let's make it a bit more tangible. Here is my list, containing 5 products.

Lists can be referenced in Decision Tables -

Here I am setting the discount to the sum of the entries in the Product List.

Makes no sense from a functional perspective, but just to illustrate usage.

### Relations

Think of a DB table e.g. Products relation

So now to a simple test - using the Decision table from the previous post -

Line 6 makes no functional sense, but demonstrates how one can leverage

relations in a DT.

I will enter an order for 123 items with a total value of 12000.

As this has a hit policy of C+ we should get a final discount based on the

values for the 3 rules which will fire (Rules 4,5,6) so that is

16+25 + price of the iBike, 1300 = 1341

Test -

### Functions

*You can create functions to define specific operations that aren’t available through*

*built-in functions. In Process, decisions created using the Function notation return a*

*value only when invoked from another decision.*

Functions can be called from a DT.

Test with the following payload -

Imbolc Discount defined as -

(price * quantity) / 100

Do the math - 1234 * 8 = 9872.

Divide by 100 = 98.72

### Loops

*Create loops to iterate over lists or arrays. Using the loop logical notation, you can*

*create three different types of loops, namely For, Some, and Every.*

*• For: Iterates over a list and returns an expression.*

*• Some: Checks if at least one list item satisfies the test condition defined by an expression*

*and returns a Boolean value.*

*• Every: Checks if every list item satisfies the test condition defined by an expression*

*and returns a Boolean value.*

Note: the loop executes for each member of the list [1,2,3,4].

Check out the other operation options -

**Some:**

Test...

**Every:**

Test...