Show TOC

Dynamic Invocation of a Decision TableLocate this document in the navigation structure

Use

You can dynamically invoke a decision table depending upon the object it satisfies.

Example

CreditCardApplication object: One of the fields in this object is cardType. Depending on the cardType specified in the application, a corresponding decision table is evaluated to determine the interest rate. There are two decision tables "STANDARD RATE TABLE" and "GOLD RATE TABLE" for STANDARD and GOLD cards. In normal scenarios, this has to be modeled in the following way:

If

 
 

CreditCardApplication.getCardType Equals "STANDARD"

Then

 
 

Evaluate DecisionTable:: "STANDARD RATE TABLE"

Else if

 
 

CreditCardApplication.getCardType Equals "GOLD"

Then

 
 

Evaluate DecisionTable:: "GOLD RATE TABLE"

Else if

 
 

CreditCardApplication.getCardType Equals "PLATINUM"

Then

 
 

Evaluate DecisionTable:: "PLATINUM RATE TABLE"

When a new card, say, PLATINUM is added to the existing portfolio, the following changes need to be made.

  • Create a corresponding decision table "PLANTINUM RATE TABLE".

  • Modify the above flow in the following way

If

 
 

CreditCardApplication.getCardType Equals "STANDARD"

Then

 
 

Evaluate DecisionTable:: "STANDARD RATE TABLE"

Else if

 
 

CreditCardApplication.getCardType Equals "GOLD"

Then

 
 

Evaluate DecisionTable:: "GOLD RATE TABLE"

Else if

 
 

CreditCardApplication.getCardType Equals "PLATINUM"

Then

 
 

Evaluate DecisionTable:: "PLATINUM RATE TABLE"

 

You need to add a new else-if block for every new table. Moreover, if the engine does not find the corresponding decision table during evaluation it will throw an exception.

With the dynamic invocation feature, assign variable definition to CreditCardApplication object and evaluate that variable. Depending on the credit card application, the variable evaluates the corresponding decision table.

The steps to dynamically invoke decision tables are as follows:

  • Create a variable definition with return type string

  • Map it to the CardType field in the CreditCardApplication object

    This returns the CardType such as "STANDARD"

  • Concatenate the variable definition to the table name

  • Assign the Evaluate Decision Table action type to the variable definition

Example

Assign :: Table Name = CreditCardApplication.getCardType

Assign Table Name = Table Name.concat(Rate Table)

Evaluate Decision Table :: Table Name