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" : [ number 1 , number 2 , ... ]
}
Example: {
"total.value" : {
"operator" : "+" ,
"input" : [ 10 , 20 , 30 ]
}
}
// Result: 60
Subtract the second number from the first. Syntax: {
"operator" : "-" ,
"input" : [ number 1 , number 2 ]
}
Example: {
"discount.value" : {
"operator" : "-" ,
"input" : [ "@fact:price.value" , 10 ]
}
}
// If price is 50, result: 40
Multiply two or more numbers. Syntax: {
"operator" : "*" ,
"input" : [ number 1 , number 2 , ... ]
}
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" : [ number 1 , number 2 ]
}
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" : [ number 1 , number 2 ]
}
Example: {
"isEven.value" : {
"operator" : "=" ,
"input" : [
{
"operator" : "%" ,
"input" : [ "@fact:number.value" , 2 ]
},
0
]
}
}
// Checks if number is even
round - Round to nearest integer
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
toFixed - Format decimal places
numberFormat - Locale formatting
Advanced Math
Find the smallest value from a list of numbers. Syntax: {
"operator" : "min" ,
"input" : [ number 1 , number 2 , ... ]
}
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" : [ number 1 , number 2 , ... ]
}
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
baseLog - Logarithm with custom base
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.
addBig - High-precision addition
Add numbers with arbitrary precision. Syntax: {
"operator" : "addBig" ,
"input" : [ number 1 , number 2 ]
}
Example: {
"preciseTotal.value" : {
"operator" : "addBig" ,
"input" : [ "0.1" , "0.2" ]
}
}
// Result: "0.3" (exact, not 0.30000000000000004)
subtractBig - High-precision subtraction
Subtract numbers with arbitrary precision. Syntax: {
"operator" : "subtractBig" ,
"input" : [ number 1 , number 2 ]
}
multiplyBig - High-precision multiplication
Multiply numbers with arbitrary precision. Syntax: {
"operator" : "multiplyBig" ,
"input" : [ number 1 , number 2 ]
}
divideBig - High-precision division
Divide numbers with arbitrary precision. Syntax: {
"operator" : "divideBig" ,
"input" : [ number 1 , number 2 ]
}
Comparison Operations
Compare values to make decisions.
Check if two values are equal. Syntax: {
"operator" : "=" ,
"input" : [ value 1 , value 2 ]
}
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" : [ value 1 , value 2 ]
}
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" : [ value 1 , value 2 ]
}
Example: {
"isPremium.value" : {
"operator" : ">" ,
"input" : [ "@fact:orderTotal.value" , 100 ]
}
}
// Returns true if order total exceeds $100
>= - Greater than or equal
Check if first value is greater than or equal to second. Syntax: {
"operator" : ">=" ,
"input" : [ value 1 , value 2 ]
}
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" : [ value 1 , value 2 ]
}
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" : [ value 1 , value 2 ]
}
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
notBetween - Value outside range
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" : [ condition 1 , condition 2 , ... ]
}
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" : [ condition 1 , condition 2 , ... ]
}
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
notEmpty - Check if not empty
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.
concat - Concatenate strings
Join multiple strings together. A space is included after the join automatically Syntax: {
"operator" : "concat" ,
"input" : [ string 1 , string 2 , ... ]
}
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"
substring - Extract substring
stringTemplate - Format template
split - Split string into array
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"]
startsWith - Check prefix
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"
stringContains - Check if contains
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"
stringNotContains - Check if doesn't contain
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"
regex - Pattern matching and extraction
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.
arrayContains - Check if array contains value
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"
arrayNotContains - Check if array doesn't contain value
Check if an array does not include a specific value. Syntax: {
"operator" : "arrayNotContains" ,
"input" : [ array , value ]
}
inArray - Check if value in array
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
notInArray - Check if value not in array
Check if a value does not exist in an array. Syntax: {
"operator" : "notInArray" ,
"input" : [ value , array ]
}
concatArray - Combine arrays
Merge multiple arrays into one. Syntax: {
"operator" : "concatArray" ,
"input" : [ array 1 , array 2 , ... ]
}
Example: {
"allItems.value" : {
"operator" : "concatArray" ,
"input" : [ "@fact:cartItems.value" , "@fact:wishlistItems.value" ]
}
}
// Combines cart and wishlist into single array
generateArray - Create array from conditions
Create an array from condition/value pairs, including only items where condition is true. Syntax: {
"operator" : "generateArray" ,
"input" : [
[ condition 1 , value 1 ],
[ condition 2 , value 2 ],
...
]
}
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 - Sort numbers and strings
Sort an array of numbers in ascending order or sort an array of strings in alphabetical order Syntax: {
"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"]
arrayFilter - Filter with boolean mask
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.
isSubset - Check if subset
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
isNotSubset - Check if not subset
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" : [ array 1 , array 2 ]
}
Example: {
"allTags.value" : {
"operator" : "setUnion" ,
"input" : [
[ "red" , "blue" ],
[ "blue" , "green" ]
]
}
}
// Result: ["red", "blue", "green"]
setIntersection - Intersection of sets
Find common elements between two arrays. Syntax: {
"operator" : "setIntersection" ,
"input" : [ array 1 , array 2 ]
}
Example: {
"commonSkills.value" : {
"operator" : "setIntersection" ,
"input" : [
"@fact:requiredSkills.value" ,
"@fact:candidateSkills.value"
]
}
}
// Returns skills that appear in both arrays
setDifference - Difference of sets
Find elements in first array that are not in second array. Syntax: {
"operator" : "setDifference" ,
"input" : [ array 1 , array 2 ]
}
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 / lookup - Key-value mapping
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
inOptions / options-in - Check if value in options
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
in - General membership check
Check if value exists in array or object keys. Syntax: {
"operator" : "in" ,
"input" : [ value , arrayOrObject ]
}
notIn - General non-membership check
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" : []
}
timeNow - Current timestamp
Get current Unix timestamp. Syntax: {
"operator" : "timeNow" ,
"input" : []
}
addDate - Add time period
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
subtractDate - Subtract time period
Subtract days, months, or years from a date. Syntax: {
"operator" : "subtractDate" ,
"input" : [ date , amount , unit ]
}
dateDiff - Calculate date difference
Calculate difference between two dates. Syntax: {
"operator" : "dateDiff" ,
"input" : [ date 1 , date 2 , unit ]
}
Example: {
"daysOverdue.value" : {
"operator" : "dateDiff" ,
"input" : [
{ "operator" : "now" , "input" : []},
"@fact:dueDate.value" ,
"days"
]
}
}
// Returns number of days between now and due date
toISO - Convert to ISO format
JSON Operations
Parse and query JSON data.
jsonParse - Parse JSON string
Convert JSON string to object. Syntax: {
"operator" : "jsonParse" ,
"input" : [ jsonString ]
}
Example: {
"parsedData.value" : {
"operator" : "jsonParse" ,
"input" : [ "@fact:jsonString.value" ]
}
}
// Converts '{"name":"John"}' to object
jsonStringify - Convert to JSON string
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.
fact - Reference another fact
Explicitly reference a fact (usually @fact: syntax is used instead). Syntax: {
"operator" : "fact" ,
"input" : [ factName ]
}
expression - Evaluate expression
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