docs.decisionrules.io Open in urlscan Pro
2606:4700:4400::6812:282f  Public Scan

Submitted URL: http://url4652.decisionrules.io/ls/click?upn=owVPXblFH-2BlnFDmuFBewbkpq5qvQt-2B5-2FBPstsdA4g0Ig6qkfgdbWMH9vDkT3esH7JiFzF7MnuevVU...
Effective URL: https://docs.decisionrules.io/doc/tutorials/create-simple-decison-table
Submission: On October 04 via api from ES — Scanned from ES

Form analysis 0 forms found in the DOM

Text Content

API Documentation

Search
⌃K

Links
DecisionRules Documentation
API
API Introduction
API Keys

Rule Solver API
Management API
Console Logs API
Business Intelligence API
Datacenters & Locations

Apache Kafka Solver API
Archive

Tutorials
Create a Simple Decision Table
Create Simple Decision Tree
Create Simple Scripting Rule
Create Simple Rule Flow
Endpoint Settings
Rule Migration Strategies
Create a Power BI Report
Decision tables
Decision Tables Introduction
Table Designer
Input & Output JSON Model

Binding to Model
Supported Data Types
Operators

Functions

Export & Import of Decision Tables

Manage Decision Tables in Excel / Google Sheets
Table Operations

Decision Trees
Decision Trees Introduction
Decision Tree Designer
Export & Import Decision Trees

Scripting Rules
Custom functions in Scripting Rules
Calling external API within ScriptingRules
Use Rule Variables in Scripting Rules
Call Embedded Rules in Scripting Rules
Export & Import Scripting Rules

Tips
Rule Flow
Rule Flow Designer
Rule Flow Mapping
Rule States in Rule Flow
Warnings & Errors
Rule Flow Limits
Export & Import Rule Flows

Other
Rule Alias
Execution Strategy
Rule State
Rule Versioning
Favorite Rules
Rule Variables
Rule Comparison

Rule Tags
Rule Dependencies
Test Bench
Single Sign-On (SSO)
Event timeline
Teamwork
Dashboard
Folders
Spaces
Manage Spaces
Share Rules Between Spaces
Users & Roles
Teamwork Indicator
SDK and Frameworks
Languages / Frameworks

Business Intelligence
Audit Logs
Connect Power BI to Business Intelligence API
Connecting from Power BI (deprecated)
Billing
Invoices & Billing
Change Product Plan
Billing Information
Regional Cloud
Regional Cloud
Region Specific API URLs
On-Premise / Docker
Environment Variables
Setup Single Sign-On (SSO)

DecisionRules Application

Docker Showcase App

AWS Setup

Microsoft Azure Setup

Azure Red Hat OpenShift
Google Kubernetes Engine (GKE)
Kubernetes Setup

Logging options
Automated Rule Migration
Terms & Conditions
Terms and Conditions
Privacy Policy
Service Level Agreement

Sub-Processor List
Roadmap 🚲 🗺️
Release Notes

Powered By GitBook


CREATE A SIMPLE DECISION TABLE


This tutorial will walk you through the creation of a simple Decision Table.
Decision Tables are without a question one of the most important tools for
creating business rules. Within DecisionRules, they are fairly easy to create
and manage. We believe that, with the help of this tutorial, you can master the
basics quickly.

HOW TO CREATE A SIMPLE DECISION TABLE

Let's advance one step at a time.
1. LOG IN

Becoming a superhero is a fairly straightforward process. After entering our
login page, you will be able to pass your credentials and log in.

There are multiple options for user login. If you do not have an account yet,
you can create one. After logging in to the application, the Dashboard will be
displayed.

2. GO TO CREATE RULE

To display the rule creation pop-up click the

button on the sidebar.

3. CREATE A NEW DECISION TABLE

You will be prompted to provide a name and choose between SAMPLE RULE or EMPTY
RULE. For now, name the rule as you wish and choose the EMPTY RULE. The new rule
will be created and its detail will be displayed. We will continue in the Rule
Settings tab.
More information can be found in our documentation on Decision Tables.

4. MAKE BASIC SETTINGS

Once we are in the Rule Settings, let's do some settings. Since we do not want
this decision table to be available yet, we will change its status to Pending.
To do this, click on the current status Published and then select Pending.
To apply these changes, we have to click the

button at the bottom of the page.

5. CREATE THE INPUT AND OUTPUT MODEL

We will now create the input and output model which is used to set conditions
and results. There are 2 ways to create these models:
Simple editor is intended for inexperienced users who do not know the syntax of
JSON files.
JSON editor is intended for an experienced user.

USING THE SIMPLE EDITOR

Let's start with the input model. First we delete all default attributes by
clicking the trash can icon. Then we add our own attributes: period,
productTypeand promoCode. We create a root for each of them by clicking the +Add
root button.
More information on the simple editor is provided here.
After creating an input or output model, we must always confirm the changes with
the

button.
Now we can continue with the output model. It will be set similarly. As root
attributes, we add pricesand message. Here, we would like to add a child
attributes to the prices. We do that by clicking the + icon within the prices
field. We rename the New Attribute to finalPrice and then add one more,
crudePrice.

USING THE JSON EDITOR

In the JSON editor, we can provide the input and output model in JSON format. In
our case, the input model will read
{
"period": {},
"productType": {},
"promoCode": {}
}

while the output model shall read
{
"prices": {
"finalPrice": {},
"crudePrice": {}
},
"message": {}
}

For now, you may just enter these values and you are done!
More information on the JSON editor can be found here.

6. SET THE CONDITIONS AND RESULTS

To create conditions and results, you must go to the Table Designer tab. Now
let's move on and bind our input and output models to our condition and result
columns.

We already have one condition column and one result column here. We start with
the conditions. Click the input dropdown and select productType. Then click the
+ button at the top of the conditions section twice to create two more columns.
Bound these to our period and promoCode input attributes. These are all the
conditions we will use.
Next we add the result columns. One is already there, so click the output
dropdown and select prices.crudePrice. Then create two more columns by clicking
the + button at the top and bind them to prices.finalPrice and message. These
are all the results we need.
More information about creating conditions and results can be found in the Table
Designer Section and Binding to Model Section.
After adding conditions and results, we can also set their names. To do this,
click the name, currently reading New Condition, and rewrite it.
Do not forget to click the

button.
7. EDIT ROWS

Currently, we have a single row in the Decision Table.
Each row of the table corresponds to one set of conditions and results. When the
Rule Solver is called, it goes through the individual rows and evaluates their
condition values against the corresponding request input data. If some values of
the conditions in a row match, Rule Solver takes the values of the individual
results on that row and places them in the output.
Let's set the conditions in the first row.
PRODUCT TYPE

Click the anything label in the productType column. You can choose a type of
condition from the Select type modal. We would like to activate the results of
this row when the value of productType is basic. We can do that simply by
selecting the Equals operator and entering the string basic.
PERIOD

We will use the Equals operator for period as well. This row will activate when
the period will be equal to month.
PROMO CODE

Here we want to check whether the customer's promo code is correct. We could
again enter the desired value with an Equal operator, but we can do better.
Let's go to Rule settings and open the Rule Variables section. Here we shall add
two Rule Variables. The first one will have name PromoCode and value SUMMER SALE
while the other will have name PromoDiscount and value 30. Rule variables make
our rules easily manageable. If we later want to change the promo code, we do it
only on a single place: in the Rule Settings.
Click Save and go back to the Decision Table Designer. Now you can add the
condition for promoCode. Select again the Equals operator and eneter
{PromoCode}in the field. This expression refers to the PromoCode Rule variable.
An overview of all operators is here. An overview of all possible values is
here.
Now we are going to continue with setting results.
CRUDE PRICE

In the prices.crudePrice column, leave the simple value denoted by = and enter
8. This is the crude price for our service in case of basic subscription for a
month.
FINAL PRICE

Because we are in the row where the promo code is matched, we will give a
discount on the crude price. Click the = sign and select Function. Then enter
the following expression:
TIMES({prices.crudePrice},DIVIDED(MINUS(100,{PromoDiscount}),100))

It means that we calculate the final price by taking the crude price and
subtracting 30% discount defined by the PromoDiscount variable. Note that we are
referring to the prices.crudePrice column by writing {prices.crudePrice}.
MESSAGE

Finally, let's include some message about what happened on this row. In the
message column, again select the Function type of the result and enter the
following expression:
CONCAT("{PromoDiscount}","% discount")

This function will take the PromoDiscount variable and concatenate it with the
given string to generate the desired message.
Do not forget to click the

button.
You can now click the three dots at the beginning of the row and select Insert
Below. This will add another empty row below. Its conditions and results may be
set analogically. More rows can be added in a similar fashion. In this way, you
can create a rule similar to the following sample rule.
sample-pricing-rule.json
38KB
Code
You can import this rule to your space by going to Decision Tables and clicking
the Import button.
8. TEST THE DECISION TABLE

Now we can test our rule in Test Bench. Before testing the rule, we must go to
Rule Settings and change the status of the decision table to Published.
If we want to test a certain row, we can click the

icon at its beginning. After clicking the icon, the values from the row will be
pre-filled in Test Bench, which will show up at the bottom of the page. We can
freely modify these values. For instance, if you click the first row of your
Decision Table, you will have to enter the correct promoCode, which should be
SUMMER SALE.
Then we can click the

button and the result will be displayed in right hand side of the Test Bench.
Note that you can switch between the Simple Bench and the JSON Bench.
For example, if we switch to the JSON Bench, we may input the following data.
{
"productType": "basic",
"period": "month",
"promoCode": "SUMMER SALE"
}

Upon hitting Run, we will get the following response.
[
{
"prices": {
"finalPrice": 5.6,
"crudePrice": 8
},
"message": "30% discount"
}
]

More information about Test Bench can be found here.
If you have arrived here, you have successfully completed the tutorial.
Congratulations!
Previous
Rule Flow Solver API (DEPRECATED)
Next - Tutorials
Create Simple Decision Tree

Last modified 3mo ago
Was this page helpful?

On this page
How to create a simple decision table
1. Log in
2. Go to Create rule
3. Create a new Decision Table
4. Make basic settings
5. Create the input and output model
6. Set the conditions and results
7. Edit rows
8. Test the Decision Table
CookiesThis site uses cookies to deliver its service and to analyse traffic. By
browsing this site, you accept the cookie policy.
Reject all


DecisionRules Documentation
API
API Introduction
API Keys

Rule Solver API
Management API
Console Logs API
Business Intelligence API
Datacenters & Locations

Apache Kafka Solver API
Archive

Tutorials
Create a Simple Decision Table
Create Simple Decision Tree
Create Simple Scripting Rule
Create Simple Rule Flow
Endpoint Settings
Rule Migration Strategies
Create a Power BI Report
Decision tables
Decision Tables Introduction
Table Designer
Input & Output JSON Model

Binding to Model
Supported Data Types
Operators

Functions

Export & Import of Decision Tables

Manage Decision Tables in Excel / Google Sheets
Table Operations

Decision Trees
Decision Trees Introduction
Decision Tree Designer
Export & Import Decision Trees

Scripting Rules
Custom functions in Scripting Rules
Calling external API within ScriptingRules
Use Rule Variables in Scripting Rules
Call Embedded Rules in Scripting Rules
Export & Import Scripting Rules

Tips
Rule Flow
Rule Flow Designer
Rule Flow Mapping
Rule States in Rule Flow
Warnings & Errors
Rule Flow Limits
Export & Import Rule Flows

Other
Rule Alias
Execution Strategy
Rule State
Rule Versioning
Favorite Rules
Rule Variables
Rule Comparison

Rule Tags
Rule Dependencies
Test Bench
Single Sign-On (SSO)
Event timeline
Teamwork
Dashboard
Folders
Spaces
Manage Spaces
Share Rules Between Spaces
Users & Roles
Teamwork Indicator
SDK and Frameworks
Languages / Frameworks

Business Intelligence
Audit Logs
Connect Power BI to Business Intelligence API
Connecting from Power BI (deprecated)
Billing
Invoices & Billing
Change Product Plan
Billing Information
Regional Cloud
Regional Cloud
Region Specific API URLs
On-Premise / Docker
Environment Variables
Setup Single Sign-On (SSO)

DecisionRules Application

Docker Showcase App

AWS Setup

Microsoft Azure Setup

Azure Red Hat OpenShift
Google Kubernetes Engine (GKE)
Kubernetes Setup

Logging options
Automated Rule Migration
Terms & Conditions
Terms and Conditions
Privacy Policy
Service Level Agreement

Sub-Processor List
Roadmap 🚲 🗺️
Release Notes

Powered By GitBook