Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

Decision Table Containing Dates

The decision table, tblRiskRating returns the medical risk rating of an individual based on their age and medical history. This decision table takes two types of input data, birthDate and medHistory. The refTypes argument stipulates that birthDate must be a date, and medHistory and riskRating (the output) must be text strings. The hit policy is "U" for Unique which means that a unique rule must resolve to a unique result. If multiple rules are "hit", an error will be returned.


"tblRiskRating": {
	inputs: ["birthDate", "medHistory"], 
	outputs: ["riskRating"],
	refTypes: ["date", "text", "text"],
	hitPolicy: "U",
	rules: [
	   [">'1970-05-05'", "good", "medium"], 
	   [">'1970-05-05'", "bad", "high"], 
	   ["['1935-05-05'..'1970-05-05']", "-", "medium"], 
	   ["<'1935-05-05'", "good", "low"], 
	   ["<'1935-05-05'", "bad", "medium"]
	]
},
  • The first rule states that if the patient's birthDate occurs after 1970-05-05 and the patient's medical history is "good", the returned riskRating will be "medium".
  • The second rule states that if the patient's birthDate occurs after 1970-05-05 and the patient's medical history is "bad", the returned riskRating will be "high".
  • The third rule states that if the patient's birthDate occurs on or between 1935-05-05 and 1970-05-05 with any type of medical history ("-"), the returned riskRating will be "medium".
  • The fourth rule states that if the patient's birthDate occurs before 1935-05-05 and the patient's medical history is "good", the returned riskRating will be "low".
  • The fifth rule states that if the patient's birthDate occurs before 1935-05-05 and the patient's medical history is "bad", the returned riskRating will be "medium".

Notice that all dates within the rules are surround by single quotes. S-FEEL defines a single format for the Date type ‘yyyy-mm-dd’. Optionally a date may begin with the letter D, for example “D1964-05-05”. Other date type formats are not supported.

Input data is passed in the data section: birthDate = 1964-05-05 and medHistory = "good".


"Date1": { value: "'1964-05-05'", comment: "bd" },
"Date2": { value: "good", comment: "mh" },

The final result request, dateResult, passes the input data to the decision table, tblRiskRating, asks for the final values.

"dateResult": { formula: "tblRiskRating(,,Date1, Date2)", finalValue: [] },

Given this input data, only one rule is successful, rule 3, which states that if the patient's birthDate occurs on or between 1935-05-05 and 1970-05-05 with any type of medical history ("-"), the returned riskRating will be "medium".

"observations": { "dateresult": { "value": "medium" },
Back to Decision Table Date/Time Intro