Skip to main content

Expressions

Expressions usage within the OpenDataDSL language

Syntax

Expressions can take various forms, so here is a list of the syntax for expressions:

// A simple variable (either existence or true)
variable

// Not variable (either non-existence or false)
not variable

// Use of braces for explicit precedence
( expression )

// Array operators
[ expression (, expression)* ]

// Mathematical Operators
expression * expression
expression / expression
expression + expression
expression - expression
expression ^ expression

// Logical Operators
expression == expression
expression = expression
expression != expression
expression < expression
expression <= expression
expression > expression
expression >= expression

// Geospatial and Special
expression like expression
expression intersects expression
expression within expression

// Filter creation (usually used with event time series or event curves)
? condition

Use within the language

Expressions are used in various places within the ODSL language as shown in the following table:

CommandDescription
AssignmentWhen assigning a value to a variable
PrintingWhen printing a message to the terminal
LoggingWhen logging a message
ReturnWhen returning a value from a script
Fail and AbortCreating a message when instructing a workflow to fail or abort
Type declarationAdding an expression as a property on a type
ExtractorUsed as a selector, check, click etc. in an extractor
ForUsed in defining a for statement
Active variableUsed as a name and options for an active variable
Method and function callsUsed as a parameter in method and function calls

Examples

Assignment examples

result = a + 1

Creating a filter on an event series

event_series.filter = ? side = "ASK" and relative = "M01"

Printing example

print “Hello “ + name

Logging example

log info “Value is “ + value

Return example

return a + 1

Fail example

fail “Value is “ + value

Type declaration example

name as first + “ “ + last

For example

for i=a+10 to a+20
next

for i in [1,2,3]
next

Methods and function calls

l.addAll([1,2,3])