Expression Syntax

This document describes the expression syntax used in the application.

Basic Syntax

Variables

  • value - Current field value
  • val - a wrapped value in a monad that introduces additional operations
  • field['fieldname'] - Access other fields
  • field.fieldname - Alternative syntax for accessing fields

Operators

Comparison Operators

- == - Equal - === - Strict equal - != - Not equal - !== - Strict not equal - < - Less than - <= - Less than or equal - > - Greater than - >= - Greater than or equal

Logical Operators

- and - Logical AND - or - Logical OR - not - Logical NOT

  1. Can be used with parentheses to negate complex expressions
  2. Example: not (value contains '1970') - Negates the result of the contains operation
  3. ! important note: always use parentheses with not, as it may lead to unexpected results!

String Operators

- ~ - String concatenation - contains - String contains - matches - Regular expression matching

Ternary Operators

- condition ? true_value : false_value - Ternary conditional

String Functions (monad)

  • val.upper() - Convert to uppercase
  • val.lower() - Convert to lowercase
  • val.split(delimiter) - Split string into array
  • val.merge(delimiter) - Join array elements with delimiter
  • val.eq(value) - Compare equality
  • val.from(value) - Transform value
  • val.value() - Return the final value from monad

Array Functions

  • array.value()[index] - Access array element by index
  • array.last() - Get last element of array

Time Functions

Time Formatting

  • time.format(datetime, format, [timezone]) - Format datetime
    • Example: time.format('2024-08-27T15:25:02.001Z', 'H:i')
    • Example with timezone: time.format('2024-08-27T15:25:02.001Z', 'H:i', 'Europe/Warsaw')

Time Duration Formatting

  • time.formatSeconds(seconds, format, [default]) - Format seconds as duration
    • Example: time.formatSeconds(value + 220, 'M:S')
    • Formats: 'M:S', 'S', 's'

Examples

String Manipulation

val.upper()                                  // Convert to uppercase
val.split('/').merge('|').upper()            // Split, join with new delimiter, uppercase

Conditional Logic

field['null_val'] === null ? 'less 0' : 'more than 0'
value !== null and not (value contains '1970') ? time.format(value, 'U') * 1000 : null

Time Formatting

time.formatSeconds(value + 220, 'M:S')       // Format seconds as minutes:seconds
time.format('2024-08-27T15:25:02.001Z', 'H:i', 'Europe/Warsaw')  // Format with timezone

Field Access

field['field2']                              // Access other field
field.all_tmp.b_string                       // Nested field access
field.all_tmp.wrong ?? ''                    // With null coalescing
expression-syntax.txt · ostatnio zmienione: 2025/05/23 13:25 przez damian.zabawa