Skip to main content

Conditions

The usage of conditions in the OpenDataDSL Language

Syntax

The syntax for a condition:

variable
| 'not' variable
| expression ('<'|'<='|'>'|'>='|'='|'=='|'!='|'like'|'intersects'|'within') expression
| condition ('and'|'or') condition
| '(' condition ')'

Use within the language

Conditions can be used at various places within the OpenDataDSL language as shown in the following table:

CommandDescription
AggregateUsed in a match directive in an aggregate command
FindUsed as a condition in a find command, searching for something
TransformUsed within a transform command in both ‘if’ statements and ‘ignore’ directives
IfUsed in the if control statement
WhileUsed in the while control statement

Examples

Aggregation Example

summary = aggregate ${exec}
    match service="ETL"
    group _id="$status", qty=count()
    sort qty desc
end

Find Example

records = find ${audit} where 
    timestamp > ${date:"today"} 
    and timestamp < ${date:"tomorrow"}
end

Transform Example

ignoe contains(ag.column\[0\], "Date")
unit="MT"
if contains(input.product, "Potato")
unit="100KGS"
end

If Example

if a==1 and b==2
    print 1
elseif (a==2 or b==2)
    print 2
elseif (a>2 and b==3) or c
    print 3
end

While Example

X=1
while X<5
   X=X+1
end