Skip to Content
Domain ConceptsSubmissionQL

SubmissionQL

SubmissionQL is a domain-specific language (DSL) used to query and transform submission data. It allows templates to define complex logic for deriving product parameters from user answers.

Syntax Overview

Operators

TypeOperatorsDescription
Arithmetic+, -, *, /Standard math operations.
Comparison==, !=, <, <=, >, >=Value comparison.
LogicalAND, ORBoolean logic.

Literals

  • Number: 123, 45.67
  • String: "Hello World"
  • Boolean: true, false

Functions

Built-in Functions

FunctionSignatureDescription
IFIF(condition, trueVal, falseVal)Conditional logic.
SUMSUM(list)Sum of a list of numbers.
AVGAVG(list)Average of a list of numbers.
MINMIN(list)Minimum value in a list.
MAXMAX(list)Maximum value in a list.
COUNTCOUNT(list)Number of items in a list.
ROUNDROUND(number)Rounds to the nearest integer.
NOWNOW()Current date/time.
YEARYEAR(date)Extracts year from date.
MONTHMONTH(date)Extracts month (1-12).
DAYDAY(date)Extracts day of month.
DATEDATE(string)Parses date string.
DATE_FORMATDATE_FORMAT(date, format)Formats a date.

Collection Functions

Used for processing arrays (e.g., lists of claims or locations).

FunctionSyntaxDescription
MAPMAP(list, FUNC(item) expression)Transforms each item.
FILTERFILTER(list, FUNC(item) condition)Selects items matching condition.
GROUPGROUP(list, FUNC(item) key)Groups items by key.

Path Navigation

Access data using the path syntax: START:SEGMENT:SEGMENT.

  • $parameter -> Value of a parameter in the current scope.
  • @unit -> Access a collection of items (Unit).
  • : -> Drill down into properties.

Examples

Simple Math

1 + 2 * 3 // Result: 7

Parameter Access

$param1 + $param2 // e.g., 5 + 3 = 8

Unit Collection Access

@unitId // Returns the array of items in the unit

Property Drill-down

@unitId:$value:id // Extracts the 'id' property from the 'value' parameter of every item in 'unitId' // Result: [1, 2, ...]

Conditional Logic

IF($age > 50, "Old", "New")

Complex Aggregation

SUM( MAP( @claims_history, FUNC(claim) claim:$amount ) )

Date Logic

DATE_FORMAT(DATE("1987,06,20"), "PPP") // Result: "June 20th, 1987"

Filtering Collections

FILTER(@unit, FUNC(x) x:$value > 1) // Returns items where value is greater than 1

Grouping Collections

GROUP(@unit, FUNC(x) x:$type) // Groups items by their 'type' parameter
Last updated on