Skip to main content

General Statements

All the general OpenDataDSL statement commands


Command to manage your user API Keys


apikey: api-key (create (start="string")? (expires="string")? |delete) "name";


An API Key is used as a password to authenticate you in OpenDataDSL from an external application that cannot use OAUTH2 or Azure Active Directory.

Explanation of the syntax
  • The name is a string that is used to identify what you are going to use the key for
  • The create directive creates a key
    • You can add an optional start date for the key
    • You can add an optional expires date for the key
  • The delete directive deletes (revokes) the named key

After running the create command, the key is output into the debug console, make sure you copy the key as this is the only time you will see it.


Create a key that starts now and never expires

api-key create "mykey" 

Create a key that starts and a date and expires

api-key create start="2024-05-01" expires="2024-12-31T23:59:59" "mykey"

Revoke a key

api-key delete "mykey"

List all your keys

print ${user:"me"}.keys


Imports functions from a script into the current script


import ${script:"name"}


The import command gets the named script from the script service and makes all the user defined functions in that script available in your current script.


If we have a script with a function, e.g. this functions.odsl script saved in the server:

// functions.odsl
function agricultural(input)
// Agricultural curve forward filled and extended to end of 3 years
filled = forwardFillCurve(input)
extended = extendCurve(filled, 3)
agricultural = shape(extended)

We can import that script and call the agricultural function, e.g.

// Import the functions we defined in functions.odsl
import ${script:"functions"}

inputcurve = ${data:"inputcurve"}
curve = agricultural(inputcurve)


Outputs a message to the console and to a process execution log


log LEVEL message


If the script is running in a process, the message is output into the process execution log. The message is also output to the console.

The LEVEL option allows you to specify the log level of the message from one of:

  • debug
  • info
  • warn
  • fatal


log debug "This is a debug message"
log info "This is an info message"
log warn "This is a warning message"
log fatal "This is a fatal message"

a = 12.2
log debug "The value is " + a


Used to log out the current user




This command is used in a script to log out the current user


Determines how errors are handled


on error (exit|ignore)


The on error statement instructs OpenDataDSL on how you want to handle errors. You have 2 options:

  • exit - this is the default action which stops the currently running script and outputs the error message
  • ignore - this option doesn’t stop the script running, but it places the error message into a scalar variable called error


Using on error exit:

on error exit

// Create a date variable
d = Date()

// Call an unknown method that will force throwing an error
print d.unknown()

Using on error ignore:

on error ignore

// Create a date variable
d = Date()

// Call an unknown method that will force throwing an error
print d.unknown()

// Script continues and we can see the error message in the variable called error
print error


Pauses execution of a script for a certain amount of time


pause number ('second'|'seconds'|'minute'|'minutes'|'hour'|'hours')


Pauses execution of a script


pause 10 seconds

pause 1 minute


Prints a message to the console


print message


The print command prints a message to the console. The message can be a string, variable or expression.


a = "example"
print a
print "This is an " + a
This is an example


Terminates the currently running script and returns a variable


return expression


The return statement terminates running of a script and returns a variable to the calling application


return "Finished"


Runs a process remotely


run processname (with input)? (log reason)? (in delay TIMEUNIT)?


The run command remotely triggers a manual run of a process. You can optionally provide a variable with input run parameters, a reason log message that will be added to the audit log and a delay for when to run the process.


With input

You can optionally provide a variable with some input information which will override or provide specific context to the process, e.g.

// Run a curve
ondate = Object() = "2021-04-26"
run CURVE_TEST with ondate
Log reason

You can optionally give a reason for manually triggering a process, this will be logged in the audit log

In delay

You can optionally delay the starting of the process, e.g.

run MY_PROCESS in 1 hour

The timeunit parameter can be one of:

  • second
  • seconds
  • minute
  • minutes
  • hour
  • hours


Send a batch of objects to a message queue


send variable (to queue)? (size INT)? (-noevent)?


The send command sends a batch variable to a message queue in order to be processed by either the data loader or an external application.

If no queue name is specified, the batch is sent to your default queue.


TO queue

You can optional specify the name of the queue to send the batch to.


You can override the default number of items sent per message using the size command


Add this option if you don’t want to trigger downstream processes, exports etc. from the sending of this message. This would be usually done if you are back-filling some historic data and only require that the data is added.


// Create a batch

// Add some objects to the batch

// Send to the default queue
send batch

// Send the batch to the queue named 'myqueue'
send batch to myqueue

// Send the batch to the queue in batches of 10 objects at a time
send batch size 10

// Send the batch to update but not trigger downstream events
send batch -noevent


Used to set a session option


set (precision INT|rounding ROUNDING_METHOD|missing (ignore|number)?|crs (earth|planar))


The set command is used to set an option within the current script session. The following options are supported:

  • decimal precision
  • rounding method
  • missing value treatment
  • coordinate reference system
Setting decimal precision

The decimal precision determines the number of decimal places to use with real numbers, e.g.

set precision 2

Sets the decimal places to 2 for all numbers

Setting the rounding method

The rounding method determines how numbers are rounded when shortening to meet the decimal precision value, you can select from one of the following methods:

  • ceiling
  • down
  • up
  • floor
  • half_down
  • half_up
Setting missing value treatment

Missing values can affect the way calculations are performed and therefore you can set the way that you want missing values to be treated. You can instruct ODSL to ignore missing values using the statement:

set missing ignore

Or you can tell ODSL to use a specific value to replace missing values, e.g. if you are summing up a list of values, you can set missing as 0 so that it would not take them into account.

Setting the coordinate reference system (CRS)

You can set the CRS to either:

  • earth
  • planar

This affects the way geospatial data is handled


Used to manually trigger a subscription


trigger name for date


The trigger command is used to manually trigger a subscription. Subscriptions are usually triggered by an a new data event, but you can also manually trigger a subscription for a specific date using this command.


// Trigger the subscription called test for the 11th June 2021
trigger test for 2021-06-11


Instructs OpenDataDSL to use a specific named environment


use environmentname


You can create multiple environments such as dev and test which are separate from your production environment, this command instructs OpenDataDSL that from this point it should use that named environment for the rest of the running script.

NOTE: For more information on environments - see here


If you have created an environment called test, you can use it with the following command:

use test