LogoLogo
API Documentation
Current Version
Current Version
  • DecisionRules Documentation
  • DecisionRules Academy
  • API
    • API Introduction
    • API Keys
      • Solver API Keys
      • Management API keys
      • BI API keys
    • Rule Solver API
    • Management API
      • Rule Migration Strategies
      • Deprecated Endpoints
    • Console Logs API
    • Business Intelligence API
      • Deprecated Endpoints
    • Datacenters & Locations
      • Global Cloud
      • Regional Cloud
    • Apache Kafka Solver API
    • Endpoint Settings
    • Archive
      • Rule Flow Solver API (DEPRECATED)
  • AI Assistant
    • About Assistant
    • Assistant Setup
      • Gemini Assistant
  • RULES
    • Rules Introduction
    • Rule List
    • Rule Mode
    • Common Rule Features
      • Input & Output Model
        • Simple Editor
        • JSON Editor
      • Test Bench
      • Rule Alias
      • Rule State
      • Versioning
      • Rule Variables
      • Execution Strategy
      • Rule Dependencies
      • Rule Export & Import
        • Rule Export
        • Rule Import
        • Managing Decision Table in Excel/Google Sheets
        • Deprecated Formats: XLSX v.1 and CSV
      • Tags
      • Rule Comparison
        • Decision Table Comparison
        • Decision Tree Comparison
        • Scripting Rule Comparison
      • Rule Lock
      • Teamwork Indicator
      • Event Timeline
    • Data Types & Functions
      • Supported Data Types
      • Operators and Functions
        • Basic operators
        • Date operators
        • Functions
          • Logical Functions
          • Math Functions
          • Date and Time Functions
          • Text Functions
          • Data Functions
          • Array Functions
          • Integration functions
          • Functions and JSON
    • Decision Table
      • Table Designer
        • Table Operations
          • Filter Values
          • Valid Values
          • Sorting
      • Binding to Model
    • Decision Tree
      • Tree Designer
    • Workflow
      • Workflow Designer
      • Workflow Nodes Overview
      • Workflow Limits
    • Scripting Rule
      • Custom functions in Scripting Rules
      • Calling external API within ScriptingRules
      • Use Rule Variables in Scripting Rules
      • Call Embedded Rules in Scripting Rules
      • Tips
    • Rule Flow
      • Rule Flow Designer
      • Rule Flow Mapping
      • Rule States in Rule Flow
      • Warnings & Errors
      • Rule Flow Limits
  • SPACE
    • Space Introduction
    • Space Info
    • Dashboard
    • Access
    • API Keys
    • Audit Logs
  • Organization
    • Organization Introduction
    • Organization List
    • Members
    • Teams
    • Spaces
    • Space Roles
    • Policies
    • Statistics
    • Settings
  • Profile
    • Profile Introduction
    • General
    • Dashboard
    • Plans
    • Add-ons
    • Limits
      • Plan Limits Explained
    • Subscriptions
    • Invoices
  • Access
    • Sign Up & Login
    • Invitations & Permissions
    • Single Sign-On (SSO)
  • Business Intelligence
    • Audit Logs
    • Power BI Connectivity
      • Create a Power BI Report
      • Connect Power BI to Business Intelligence API
      • Connecting from Power BI (deprecated)
      • Connect DecisionRules to Power BI Using Our Custom Connector
  • OTHER DEPLOYMENT OPTIONS
    • Regional Cloud
      • Region Specific API URLs
    • Docker & On-Premise
      • Environment Variables
      • Redis Connection Modes
      • DecisionRules Application
        • Minimal Requirements
        • DecisionRules Server
        • DecisionRules Client
        • DecisionRules Business Intelligence
        • Networking Between Docker Containers
      • Setup Single Sign-On (SSO)
        • Set up Microsoft Entra ID SSO
        • Set up Google SSO
      • Docker Showcase App
        • Showcase
        • Showcase + Business Intelligence
      • AWS Setup
        • AWS ECS/Fargate
        • Cache - Amazon ElastiCache
      • Microsoft Azure Setup
        • Database - Azure CosmosDB
        • Cache - Azure Cache for Redis
        • Azure Container Apps
      • Azure Red Hat OpenShift
      • Google Kubernetes Engine (GKE)
      • Kubernetes Setup
        • Kubernetes Setup with Business Intelligence
      • Logging options
      • CD/CI Pipelines
        • Azure DevOps CICD Pipelines
        • Using Migration script (old way)
      • Offline License
      • White Labeling
  • SDK and Integrations
    • Languages / Frameworks
      • SQL Server
      • Oracle PL/SQL
      • PostgreSQL
      • JavaScript
      • Java Spring Example
      • PHP Library
      • Python Library
      • .NET Library
      • Google Tag Manager
    • Excel Add-in
  • Terms & Conditions
    • Terms and Conditions
    • Privacy Policy
    • Service Level Agreement
      • Community Support
      • Standard Cloud (SaaS)
      • Silver SLA
      • Gold SLA
      • Custom SLA
    • Sub-Processor List
  • Product Updates
    • Release Notes
      • Public Cloud
      • On-Premise / Private Cloud
    • Major Updates
      • Changes in Version 1.19.0 (10/2024)
      • Changes in Version 1.20.0 (4/2025)
    • Roadmap
Powered by GitBook
On this page
  • Categories of Functions
  • General Usage and Principles
  • Syntax
  • Values

Was this helpful?

  1. RULES
  2. Data Types & Functions
  3. Operators and Functions

Functions

On this page, you'll get an introduction to the key principles of writing functions in DecisionRules. A detailed guide to all available functions is found in the following sections.

Last updated 23 days ago

Was this helpful?

DecisionRules functions are essential for building decision processes of any complexity. These functions can be applied in different rule types, such as , and , allowing users to write mathematical and logical expressions in both conditions and results

Categories of Functions

Functions are divided into several categories based on their area of application:

  • Math functions

  • Logical functions

  • Date and time functions

  • Text functions

  • Data functions

  • Array functions

  • Integration functions

General Usage and Principles

Though the functions have broad applications and behaviors, they share several core principles. These apply universally across all functions. Below is a quick overview, supported by basic examples.

Syntax

The syntax for DecisionRules functions is simple. Functions are written using their names (always uppercase, occasionally containing underscores) followed by parentheses that enclose the function arguments, separated by commas.

SUM(1,4,5)  --> 10

Each function accepts a variable number of arguments, some optional, while others do not need any arguments at all.

Example of no-argument function:

NOW()   --> returns the current date and time

In Decision Tables, functions can be used in condition, result, and calculation columns.

  • Condition columns: You can choose the function from the operators modal, which opens when you click the operator badge. Functions in these columns must evaluate to boolean values (true or false).

  • Calculation and result columns: These do not have the operators modal. Simply start typing the function name, and a dropdown whisper will appear, showing all matching functions.

Values

DecisionRules supports several data types:

  • Primitive types: number, string, boolean, null.

  • Complex types: arrays, objects.

  • Additional types for functions: date, regular expressions.

Basic syntax examples:

12.1          --> number
"abc"         --> string
true          --> boolean
false         --> boolean
null          --> null

As shown above, strings are typically enclosed in double quotes. For simple string expressions that do not contain special characters [*/+-(),%{}], the quotes can be omitted. However, we recommend keeping them for clarity and consistency.

Special characters within strings can be handled with either single quotes or escape sequences:

"abcd"        --> abcd
'ab"cd'       --> ab"cd
"ab\"cd"      --> ab"cd
"ab\'cd"      --> ab'cd
"ab'cd"       --> ab'cd
"ab\\cd"      --> ab\cd

Type Conversion

Functions in DecisionRules often handle type casting automatically. If possible, they will convert values to the required type.

SUM(1,4,"5")    --> 10

However, type casting does not always work. If values cannot be converted, the function will either fail validation or return an error at runtime.

SUM(1,4,"abc")    --> invalid

Arrays and Objects

Some functions accept arrays or objects as arguments. DecisionRules uses JSON-like syntax for arrays and objects.

SUM([1,4,5])    --> 10
[1,4,5]                     --> array of numbers
[{"id":"A5B52","price":45}] --> array of objects
{"id":"A5B52","price":45}   --> object with key-value pairs

Nesting Functions

Functions can be nested inside each other. For instance, one function's result can be passed as an argument to another function.

SUM(MAX(1,2),1)    --> 3

Here, MAX(1,2) evaluates to 2, which is then used in the SUM function.

Variables

There are five types of variables that can be used in functions:

  • Input variables: represent the rule's input data.

  • Output variables: represent the rule's output data.

  • Rule variables: user-defined variables with rule-level scope.

  • Calculation column variables: variables declared in calculation columns in Decision Tables.

  • Abstract function variables: special variables used in certain functions.

Variables are referenced using curly brackets ({}).

// number = 3

SUM({number},6)   --> 9

In cases where the value from the variable cannot be used, the evaluation will fail and return an empty value:

// number = "a"

SUM({number},6)   --> null

Functions in Decision Tables

In Decision Tables, functions can be used in condition, result, and calculation columns.

  • Result columns can contain any type of function.

  • Condition columns must evaluate to boolean values (true or false).

  • Calculation columns allow users to define variables or intermediary values that can be used in other columns for more complex calculations.

When using functions in a decision table, you can turn on the Debug Mode and open the Console to see the detail of how they evaluated.

Read more in the section.

Supported Data Types
Decision Tables
Decision Trees
Workflows
How functions can be used in a decision table
Example of functions in the condition and calculation columns