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 Time

The decision table, tblTollTax returns the type of traffic one might encounter and the toll cost incurred when entering a toll road. This decision table takes one input, operTime or the time the car is expected to enter the toll road. Two outputs are returned, traffic, which specifies if traffic will be high medium or low, and the toll cost. According to our refTypes component, the input operTime must be a time, the output traffic will return a text string and the output toll will return a number. The hit policy is "U" for Unique.


"tblTollTax": {
	inputs: ["operTime"], 
	outputs: ["traffic", "toll"],
	refTypes: ["time", "text", "number"],
	hitPolicy: "U",
	rules: [
	   [">'19:00:00'", "low", 5], 
       ["['15:00:00'..'19:00:00']", "high", 7],
	   ["['09:00:00'..'15:00:00')", "medium", 6], 
	   ["['06:00:00'..'09:00:00')", "high", 7],
	   ["<'06:00:00'", "low", 5]
	]	
},
  • The first rule states that if a vehicle enters the toll road after 19:00 (or 7 pm), traffic will be low and the assessed toll will be $5.
  • The second rule states that if a vehicle enters the toll road at or between 15:00 (or 3 pm) and 19:00, inclusive, (7 pm), traffic will be high and the assessed toll will be $7.
  • The third rule states that if a vehicle enters the toll road at or after 9:00 (or 9 am) and before 15:00 (3 pm), traffic will be medium and the assessed toll will be $6.
  • The fourth rule states that if a vehicle enters the toll road at or after 6:00 (or 6 am) and before 9:00 (9 am), traffic will be high and the assessed toll will be $7.
  • The fifth rule states that if a vehicle enters the toll road before 6:00 (or 6 am) traffic will be low and the assessed toll will be $5.

Again, notice that all times must be surround by single quotes. Optionally, we could enter the times using the format beginning with the letter T such as in “T18:29:30”. Usually this time format denotes local time. If we want to specify the UTC time, add z at the end of the format, for example “T18:29:30z”. However, it’s important to note that the z time format is just a readable format. The RASON Server cannot effectively convert local and zulu times, because the location of the local time is not specified in the supported format.

Input data is passed in the data section: actualTimeEntered = 18:50:05.

"actualTimeEntered": { value: "'18:50:05'", comment: "bynow" },

The final result requests, tollResult and trafficResult, pass the input data to the decision table, tblTollTax and request the final values.


"tollResult": { formula: "tblTollTax('toll',,actualTimeEntered)", finalValue: [] },
"trafficResult": { formula: "tblTollTax('traffic',,actualTimeEntered)", finalValue: [] },

Given this input data, only one rule is successful, rule 2, which states that if the vehicle enters the toll road at exactly 15:00 (or 3 pm) or till and 19:00, inclusive, (7 pm), traffic will be high and the assessed toll will be $7.


"tollResult": { "value": 7 }, 
"trafficResult": { "value": "high" }, 
Back to Decision Table Date Example