Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.quiva.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This reference documents all available operators in the Rules engine, organized by category. Each operator includes syntax, parameters, and practical examples.
Quick search tip: Use Ctrl+F (or Cmd+F on Mac) to search for specific operators on this page.

Math Operations

Perform arithmetic calculations and number formatting.

Basic Arithmetic

Add two or more numbers together.Syntax:
{
  "operator": "+",
  "input": [number1, number2, ...]
}
Example:
{
  "total.value": {
    "operator": "+",
    "input": [10, 20, 30]
  }
}
// Result: 60
Subtract the second number from the first.Syntax:
{
  "operator": "-",
  "input": [number1, number2]
}
Example:
{
  "discount.value": {
    "operator": "-",
    "input": ["@fact:price.value", 10]
  }
}
// If price is 50, result: 40
Multiply two or more numbers.Syntax:
{
  "operator": "*",
  "input": [number1, number2, ...]
}
Example:
{
  "lineTotal.value": {
    "operator": "*",
    "input": ["@fact:price.value", "@fact:quantity.value"]
  }
}
// If price=25, quantity=4, result: 100
Divide the first number by the second.Syntax:
{
  "operator": "/",
  "input": [number1, number2]
}
Example:
{
  "averagePrice.value": {
    "operator": "/",
    "input": ["@fact:totalPrice.value", "@fact:itemCount.value"]
  }
}
// If totalPrice=100, itemCount=4, result: 25
Raise the first number to the power of the second.Syntax:
{
  "operator": "^",
  "input": [base, exponent]
}
Example:
{
  "squared.value": {
    "operator": "^",
    "input": ["@fact:number.value", 2]
  }
}
// If number=5, result: 25
Get the remainder after division.Syntax:
{
  "operator": "%",
  "input": [number1, number2]
}
Example:
{
  "isEven.value": {
    "operator": "=",
    "input": [
      {
        "operator": "%",
        "input": ["@fact:number.value", 2]
      },
      0
    ]
  }
}
// Checks if number is even

Rounding & Formatting

Round a number to the nearest whole number.Syntax:
{
  "operator": "round",
  "input": [number]
}
Example:
{
  "rounded.value": {
    "operator": "round",
    "input": [3.7]
  }
}
// Result: 4
Round up to the nearest integer.Syntax:
{
  "operator": "ceil",
  "input": [number]
}
Example:
{
  "roundedUp.value": {
    "operator": "ceil",
    "input": [3.2]
  }
}
// Result: 4
Round down to the nearest integer.Syntax:
{
  "operator": "floor",
  "input": [number]
}
Example:
{
  "roundedDown.value": {
    "operator": "floor",
    "input": [3.9]
  }
}
// Result: 3
Remove decimal part, keeping only the integer.Syntax:
{
  "operator": "trunc",
  "input": [number]
}
Example:
{
  "truncated.value": {
    "operator": "trunc",
    "input": [3.9]
  }
}
// Result: 3
Format a number to a specific number of decimal places.Syntax:
{
  "operator": "toFixed",
  "input": [number, decimalPlaces]
}
Example:
{
  "formatted.value": {
    "operator": "toFixed",
    "input": [3.14159, 2]
  }
}
// Result: "3.14"
Format a number according to locale settings.Syntax:
{
  "operator": "numberFormat",
  "input": [number, decimalPlaces]
}
Example:
{
  "displayPrice.value": {
    "operator": "numberFormat",
    "input": ["@fact:price.value", 2]
  }
}
// If price=1234.5, result: "1,234.50"

Advanced Math

Find the smallest value from a list of numbers.Syntax:
{
  "operator": "min",
  "input": [number1, number2, ...]
}
Example:
{
  "lowestPrice.value": {
    "operator": "min",
    "input": [29.99, 19.99, 39.99]
  }
}
// Result: 19.99
Find the largest value from a list of numbers.Syntax:
{
  "operator": "max",
  "input": [number1, number2, ...]
}
Example:
{
  "bestDiscount.value": {
    "operator": "max",
    "input": ["@fact:memberDiscount.value", "@fact:volumeDiscount.value"]
  }
}
// Returns the better discount
Calculate the natural logarithm (base e).Syntax:
{
  "operator": "log",
  "input": [number]
}
Example:
{
  "logarithm.value": {
    "operator": "log",
    "input": [10]
  }
}
// Result: ~2.303
Calculate logarithm with a specified base.Syntax:
{
  "operator": "baseLog",
  "input": [number, base]
}
Example:
{
  "log2.value": {
    "operator": "baseLog",
    "input": [8, 2]
  }
}
// Result: 3 (because 2^3 = 8)
Returns Euler’s number (approximately 2.718).Syntax:
{
  "operator": "e",
  "input": []
}
Example:
{
  "eulerNumber.value": {
    "operator": "e",
    "input": []
  }
}
// Result: 2.718281828459045

Big Number Operations

For high-precision calculations that avoid floating-point errors.
Add numbers with arbitrary precision.Syntax:
{
  "operator": "addBig",
  "input": [number1, number2]
}
Example:
{
  "preciseTotal.value": {
    "operator": "addBig",
    "input": ["0.1", "0.2"]
  }
}
// Result: "0.3" (exact, not 0.30000000000000004)
Subtract numbers with arbitrary precision.Syntax:
{
  "operator": "subtractBig",
  "input": [number1, number2]
}
Multiply numbers with arbitrary precision.Syntax:
{
  "operator": "multiplyBig",
  "input": [number1, number2]
}
Divide numbers with arbitrary precision.Syntax:
{
  "operator": "divideBig",
  "input": [number1, number2]
}

Comparison Operations

Compare values to make decisions.
Check if two values are equal.Syntax:
{
  "operator": "=",
  "input": [value1, value2]
}
Example:
{
  "isActive.value": {
    "operator": "=",
    "input": ["@fact:status.value", "active"]
  }
}
// Returns true if status is "active"
Check if two values are not equal.Syntax:
{
  "operator": "!=",
  "input": [value1, value2]
}
Example:
{
  "needsReview.value": {
    "operator": "!=",
    "input": ["@fact:status.value", "approved"]
  }
}
// Returns true if status is not "approved"
Check if first value is greater than second.Syntax:
{
  "operator": ">",
  "input": [value1, value2]
}
Example:
{
  "isPremium.value": {
    "operator": ">",
    "input": ["@fact:orderTotal.value", 100]
  }
}
// Returns true if order total exceeds $100
Check if first value is greater than or equal to second.Syntax:
{
  "operator": ">=",
  "input": [value1, value2]
}
Example:
{
  "qualifies.value": {
    "operator": ">=",
    "input": ["@fact:age.value", 18]
  }
}
// Returns true if age is 18 or older
Check if first value is less than second.Syntax:
{
  "operator": "<",
  "input": [value1, value2]
}
Example:
{
  "needsMoreInventory.value": {
    "operator": "<",
    "input": ["@fact:stock.value", 10]
  }
}
// Returns true if stock is below 10
Check if first value is less than or equal to second.Syntax:
{
  "operator": "<=",
  "input": [value1, value2]
}
Example:
{
  "isBudget.value": {
    "operator": "<=",
    "input": ["@fact:price.value", 50]
  }
}
// Returns true if price is $50 or less
Check if a value falls within a range.Syntax:
{
  "operator": "between",
  "input": [value, min, max, inclusivity]
}
Parameters:
  • value - The value to check
  • min - Minimum value
  • max - Maximum value
  • inclusivity (optional) - One of:
    • "INCLUSIVE" (default) - Both boundaries included
    • "EXCLUSIVE" - Both boundaries excluded
    • "INCLUSIVE_LEFT" - Only left boundary included
    • "EXCLUSIVE_LEFT" - Only left boundary excluded
    • "INCLUSIVE_RIGHT" - Only right boundary included
    • "EXCLUSIVE_RIGHT" - Only right boundary excluded
Examples:
{
  "isMiddleAge.value": {
    "operator": "between",
    "input": ["@fact:age.value", 30, 50, "INCLUSIVE"]
  }
}
// Returns true if age is between 30 and 50 (both inclusive)
{
  "inRange.value": {
    "operator": "between",
    "input": ["@fact:price.value", 100, 200, "EXCLUSIVE_LEFT"]
  }
}
// Returns true if 100 < price <= 200
Check if a value falls outside a range.Syntax:
{
  "operator": "notBetween",
  "input": [value, min, max]
}
Example:
{
  "needsSpecialHandling.value": {
    "operator": "notBetween",
    "input": ["@fact:temperature.value", 32, 100]
  }
}
// Returns true if temperature is below 32 or above 100

Logic Operations

Combine conditions with boolean logic.
Check if all conditions are true.Syntax:
{
  "operator": "and",
  "input": [condition1, condition2, ...]
}
Example:
{
  "eligible.value": {
    "operator": "and",
    "input": [
      {
        "operator": ">=",
        "input": ["@fact:age.value", 18]
      },
      {
        "operator": "=",
        "input": ["@fact:hasLicense.value", true]
      }
    ]
  }
}
// True only if age >= 18 AND hasLicense is true
Check if any condition is true.Syntax:
{
  "operator": "or",
  "input": [condition1, condition2, ...]
}
Example:
{
  "freeShipping.value": {
    "operator": "or",
    "input": [
      {
        "operator": ">=",
        "input": ["@fact:orderTotal.value", 50]
      },
      {
        "operator": "=",
        "input": ["@fact:isPremium.value", true]
      }
    ]
  }
}
// True if order >= $50 OR customer is premium
Invert a boolean value or an array of boolean values.Syntax:
{
  "operator": "not",
  "input": [condition]
}
Example:
{
  "isInactive.value": {
    "operator": "not",
    "input": ["@fact:isActive.value"]
  }
}
// Returns opposite of isActive

{
  "isInactive.value": {
    "operator": "not",
    "input": [
        "@fact:isActive.value",
        "@fact:isInactive.value"
    ]
  }
}
// Returns opposite of isActive and the opposite of isInactive as an array
Check if a value is empty, null, or undefined.Syntax:
{
  "operator": "empty",
  "input": [value]
}
Example:
{
  "needsInput.value": {
    "operator": "empty",
    "input": ["@fact:userInput.value"]
  }
}
// True if userInput is empty, null, or undefined
Check if a value has content.Syntax:
{
  "operator": "notEmpty",
  "input": [value]
}
Example:
{
  "hasEmail.value": {
    "operator": "notEmpty",
    "input": ["@fact:email.value"]
  }
}
// True if email has a value

String Operations

Manipulate and search text.
Join multiple strings together. A space is included after the join automaticallySyntax:
{
  "operator": "concat",
  "input": [string1, string2, ...]
}
Example:
{
  "fullName.value": {
    "operator": "concat",
    "input": ["@fact:firstName.value", "@fact:lastName.value"]
  }
}
// If firstName="John", lastName="Smith", result: "John Smith"
Join values with commas.Syntax:
{
  "operator": "join",
  "input": [arrayOrValues]
}
Example:
{
  "tags.value": {
    "operator": "join",
    "input": [["red", "large", "sale"]]
  }
}
// Result: "red,large,sale"
Extract part of a string.Syntax:
{
  "operator": "substring",
  "input": [string, start, length]
}
Example:
{
  "firstThree.value": {
    "operator": "substring",
    "input": ["@fact:code.value", 0, 3]
  }
}
// If code="ABC123", result: "ABC"
Replace placeholders in a template string.Syntax:
{
  "operator": "stringTemplate",
  "input": ["template with {{1}}, {{2}}", value1, value2]
}
Example:
{
  "message.value": {
    "operator": "stringTemplate",
    "input": [
      "Hello {{1}}, your order #{{2}} is ready!",
      "@fact:customerName.value",
      "@fact:orderNumber.value"
    ]
  }
}
// Result: "Hello John, your order #12345 is ready!"
Split a string into an array using a delimiter.Syntax:
{
  "operator": "split",
  "input": [string, delimiter]
}
Example:
{
  "parts.value": {
    "operator": "split",
    "input": ["@fact:csvLine.value", ","]
  }
}
// If csvLine="red,blue,green", result: ["red", "blue", "green"]
Check if string starts with a specific prefix.Syntax:
{
  "operator": "startsWith",
  "input": [string, prefix]
}
Example:
{
  "isHttps.value": {
    "operator": "startsWith",
    "input": ["@fact:url.value", "https://"]
  }
}
// True if URL starts with "https://"
Check if string ends with a specific suffix.Syntax:
{
  "operator": "endsWith",
  "input": [string, suffix]
}
Example:
{
  "isImage.value": {
    "operator": "endsWith",
    "input": ["@fact:filename.value", ".jpg"]
  }
}
// True if filename ends with ".jpg"
Check if string contains a substring.Syntax:
{
  "operator": "stringContains",
  "input": [string, substring]
}
Example:
{
  "hasKeyword.value": {
    "operator": "stringContains",
    "input": ["@fact:description.value", "urgent"]
  }
}
// True if description contains "urgent"
Check if string does not contain a substring.Syntax:
{
  "operator": "stringNotContains",
  "input": [string, substring]
}
Example:
{
  "isClean.value": {
    "operator": "stringNotContains",
    "input": ["@fact:comment.value", "spam"]
  }
}
// True if comment doesn't contain "spam"
Extract text using regular expression patterns. Returns the first captured group or the entire match if no groups are defined.Syntax:
{
  "operator": "regex",
  "input": [string, pattern]
}
Parameters:
  • string - The text to search
  • pattern - Regular expression pattern (use \\ to escape backslashes in JSON)
Examples:Extract year from date:
{
    "year.value": {
    "operator": "regex",
    "input": ["02/03/2012", "(\\d{4})$"]
    }
}
// Result: "2012"
Extract email domain:
{
    "domain.value": {
    "operator": "regex",
    "input": ["user@example.com", "@(.+)$"]
    }
}
// Result: "example.com"
Extract phone area code:
{
    "areaCode.value": {
    "operator": "regex",
    "input": ["(555) 123-4567", "\\((\\d{3})\\)"]
    }
}
// Result: "555"
Validate and extract:
{
    "isValidEmail.value": {
    "operator": "regex",
    "input": ["@fact:email.value", "^[\\w.-]+@[\\w.-]+\\.\\w+$"]
    }
}
// Returns the email if valid, null if invalid
Common patterns:
  • \\d - Any digit (0-9)
  • \\w - Any word character (a-z, A-Z, 0-9, _)
  • \\s - Any whitespace
  • . - Any character
  • + - One or more
  • * - Zero or more
  • ^ - Start of string
  • $ - End of string
  • () - Capture group
Note: Remember to escape backslashes in JSON strings (use \\d not \d)

Array Operations

Work with lists and collections.
Check if an array includes a specific value.Syntax:
{
  "operator": "arrayContains",
  "input": [array, value]
}
Example:
{
  "hasRed.value": {
    "operator": "arrayContains",
    "input": ["@fact:colors.value", "red"]
  }
}
// True if colors array contains "red"
Check if an array does not include a specific value.Syntax:
{
  "operator": "arrayNotContains",
  "input": [array, value]
}
Check if a value exists in an array (same as arrayContains, different parameter order).Syntax:
{
  "operator": "inArray",
  "input": [value, array]
}
Example:
{
  "isValidStatus.value": {
    "operator": "inArray",
    "input": ["@fact:status.value", ["pending", "approved", "shipped"]]
  }
}
// True if status is one of the valid values
Check if a value does not exist in an array.Syntax:
{
  "operator": "notInArray",
  "input": [value, array]
}
Merge multiple arrays into one.Syntax:
{
  "operator": "concatArray",
  "input": [array1, array2, ...]
}
Example:
{
  "allItems.value": {
    "operator": "concatArray",
    "input": ["@fact:cartItems.value", "@fact:wishlistItems.value"]
  }
}
// Combines cart and wishlist into single array
Create an array from condition/value pairs, including only items where condition is true.Syntax:
{
  "operator": "generateArray",
  "input": [
    [condition1, value1],
    [condition2, value2],
    ...
  ]
}
Example:
{
  "selectedFeatures.value": {
    "operator": "generateArray",
    "input": [
      [{"operator": "=", "input": ["@fact:hasCamera.value", true]}, "Camera"],
      [{"operator": "=", "input": ["@fact:hasGPS.value", true]}, "GPS"],
      [{"operator": "=", "input": ["@fact:hasBluetooth.value", true]}, "Bluetooth"]
    ]
  }
}
// Returns array like ["Camera", "GPS"] for selected features
Sort an array of numbers in ascending order or sort an array of strings in alphabetical orderSyntax:
{
  "operator": "sort",
  "input": [array]
}
Example: Sort numbers
{
  "sortedPrices.value": {
    "operator": "sort",
    "input": [[49.99, 19.99, 29.99]]
  }
}
// Result: [19.99, 29.99, 49.99]
Example: Sort strings
{
  "sortedNames.value": {
    "operator": "sort",
    "input": [["Charlie", "Alice", "Bob"]]
  }
}
// Result: ["Alice", "Bob", "Charlie"]
Filter an array using a boolean mask array.Syntax:
{
  "operator": "arrayFilter",
  "input": [array, booleanMaskArray]
}
Example:
{
  "activeItems.value": {
    "operator": "arrayFilter",
    "input": [
      "@fact:items.value",
      "@fact:items.value/*/isActive"
    ]
  }
}
// Keeps only items where isActive is true

Set Operations

Perform mathematical set operations on arrays.
Check if first array is a subset of second array.Syntax:
{
  "operator": "isSubset",
  "input": [subset, superset]
}
Example:
{
  "hasRequiredSkills.value": {
    "operator": "isSubset",
    "input": [
      ["JavaScript", "React"],
      "@fact:candidateSkills.value"
    ]
  }
}
// True if candidate has all required skills
Check if first array is not a subset of second array.Syntax:
{
  "operator": "isNotSubset",
  "input": [subset, superset]
}
Combine two arrays, removing duplicates.Syntax:
{
  "operator": "setUnion",
  "input": [array1, array2]
}
Example:
{
  "allTags.value": {
    "operator": "setUnion",
    "input": [
      ["red", "blue"],
      ["blue", "green"]
    ]
  }
}
// Result: ["red", "blue", "green"]
Find common elements between two arrays.Syntax:
{
  "operator": "setIntersection",
  "input": [array1, array2]
}
Example:
{
  "commonSkills.value": {
    "operator": "setIntersection",
    "input": [
      "@fact:requiredSkills.value",
      "@fact:candidateSkills.value"
    ]
  }
}
// Returns skills that appear in both arrays
Find elements in first array that are not in second array.Syntax:
{
  "operator": "setDifference",
  "input": [array1, array2]
}
Example:
{
  "missingSkills.value": {
    "operator": "setDifference",
    "input": [
      "@fact:requiredSkills.value",
      "@fact:candidateSkills.value"
    ]
  }
}
// Returns required skills the candidate doesn't have

Lookup & Mapping

Map values and check membership.
Map a key to a value using a lookup object, with optional default.Syntax:
{
  "operator": "map",
  "input": [key, lookupObject, defaultValue]
}
Example:
{
  "stateTax.value": {
    "operator": "map",
    "input": [
      "@fact:state.value",
      {
        "CA": 0.0725,
        "NY": 0.08,
        "TX": 0.0625
      },
      0.05
    ]
  }
}
// Returns tax rate for state, or 0.05 if not found
Check if a value exists in an options list.Syntax:
{
  "operator": "inOptions",
  "input": [value, optionsArray]
}
Example:
{
  "isValidSize.value": {
    "operator": "inOptions",
    "input": [
      "@fact:selectedSize.value",
      ["S", "M", "L", "XL"]
    ]
  }
}
// True if selected size is valid
Check if value exists in array or object keys.Syntax:
{
  "operator": "in",
  "input": [value, arrayOrObject]
}
Check if value doesn’t exist in array or object keys.Syntax:
{
  "operator": "notIn",
  "input": [value, arrayOrObject]
}

Date Operations

Work with dates and times.
Get today’s date (without time).Syntax:
{
  "operator": "today",
  "input": []
}
Example:
{
  "currentDate.value": {
    "operator": "today",
    "input": []
  }
}
// Returns today's date
Get current date and time.Syntax:
{
  "operator": "now",
  "input": []
}
Get current Unix timestamp.Syntax:
{
  "operator": "timeNow",
  "input": []
}
Add days, months, or years to a date.Syntax:
{
  "operator": "addDate",
  "input": [date, amount, unit]
}
Example:
{
  "dueDate.value": {
    "operator": "addDate",
    "input": ["@fact:orderDate.value", 30, "days"]
  }
}
// Adds 30 days to order date
Subtract days, months, or years from a date.Syntax:
{
  "operator": "subtractDate",
  "input": [date, amount, unit]
}
Calculate difference between two dates.Syntax:
{
  "operator": "dateDiff",
  "input": [date1, date2, unit]
}
Example:
{
  "daysOverdue.value": {
    "operator": "dateDiff",
    "input": [
      {"operator": "now", "input": []},
      "@fact:dueDate.value",
      "days"
    ]
  }
}
// Returns number of days between now and due date
Format a date as a string.Syntax:
{
  "operator": "dateFormat",
  "input": [date, format]
}
Example:
{
  "displayDate.value": {
    "operator": "dateFormat",
    "input": ["@fact:orderDate.value", "YYYY-MM-DD"]
  }
}
// Formats date as "2025-10-09"
Convert date to ISO 8601 string.Syntax:
{
  "operator": "toISO",
  "input": [date]
}

JSON Operations

Parse and query JSON data.
Convert JSON string to object.Syntax:
{
  "operator": "jsonParse",
  "input": [jsonString]
}
Example:
{
  "parsedData.value": {
    "operator": "jsonParse",
    "input": ["@fact:jsonString.value"]
  }
}
// Converts '{"name":"John"}' to object
Convert object to JSON string.Syntax:
{
  "operator": "jsonStringify",
  "input": [object]
}
Example:
{
  "jsonOutput.value": {
    "operator": "jsonStringify",
    "input": ["@fact:dataObject.value"]
  }
}
// Converts object to JSON string
Query JSON data using JSONPath syntax.Syntax:
{
  "operator": "jPath",
  "input": [data, path, delimiter]
}
Example:
{
  "firstItemName.value": {
    "operator": "jPath",
    "input": [
      "@fact:cartItems.value",
      "$.0.name"
    ]
  }
}
// Extracts name from first item
With delimiter for joining results:
{
  "allNames.value": {
    "operator": "jPath",
    "input": [
      "@fact:items.value",
      "$[*].name",
      ", "
    ]
  }
}
// Returns "Item1, Item2, Item3"

System Operations

Special system-level operations.
Explicitly reference a fact (usually @fact: syntax is used instead).Syntax:
{
  "operator": "fact",
  "input": [factName]
}
Evaluate a mathematical expression (advanced use).Syntax:
{
  "operator": "expression",
  "input": [expressionString]
}

What’s Next?

Rule Patterns

Learn common patterns for using these operators effectively

Examples Library

See real-world examples using multiple operators together

Core Concepts

Understand how operators fit into the bigger picture

Getting Started

Build your first rule with step-by-step guidance
Need Help? Visit our Help Center or join the Community for support.