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
| Type | Operators | Description |
|---|---|---|
| Arithmetic | +, -, *, / | Standard math operations. |
| Comparison | ==, !=, <, <=, >, >= | Value comparison. |
| Logical | AND, OR | Boolean logic. |
Literals
- Number:
123,45.67 - String:
"Hello World" - Boolean:
true,false
Functions
Built-in Functions
| Function | Signature | Description |
|---|---|---|
| IF | IF(condition, trueVal, falseVal) | Conditional logic. |
| SUM | SUM(list) | Sum of a list of numbers. |
| AVG | AVG(list) | Average of a list of numbers. |
| MIN | MIN(list) | Minimum value in a list. |
| MAX | MAX(list) | Maximum value in a list. |
| COUNT | COUNT(list) | Number of items in a list. |
| ROUND | ROUND(number) | Rounds to the nearest integer. |
| NOW | NOW() | Current date/time. |
| YEAR | YEAR(date) | Extracts year from date. |
| MONTH | MONTH(date) | Extracts month (1-12). |
| DAY | DAY(date) | Extracts day of month. |
| DATE | DATE(string) | Parses date string. |
| DATE_FORMAT | DATE_FORMAT(date, format) | Formats a date. |
Collection Functions
Used for processing arrays (e.g., lists of claims or locations).
| Function | Syntax | Description |
|---|---|---|
| MAP | MAP(list, FUNC(item) expression) | Transforms each item. |
| FILTER | FILTER(list, FUNC(item) condition) | Selects items matching condition. |
| GROUP | GROUP(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: 7Parameter Access
$param1 + $param2
// e.g., 5 + 3 = 8Unit Collection Access
@unitId
// Returns the array of items in the unitProperty 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 1Grouping Collections
GROUP(@unit, FUNC(x) x:$type)
// Groups items by their 'type' parameterLast updated on