Variables
Introductionβ
Variables are used within the language to represent some data, this could simply be a number or it could be a more complex object such as a TimeSeries.
Variables in OpenDataDSL are typeless, meaning you don't need to initialise a variable of a certain type although it is implied by the value you give it or the way you construct it, e.g.
// This creates a String or rather a Scalar variable of type String
myvar = "Hello World"
// This creates a Date variable (initialised as now) using a constructor
mydate = Date()
Naming Conventionsβ
In OpenDataDSL, you can have both public and private data and objects, so it is important to understand how you reference these in your scripts and objects.
If an id is prefixed with a '#' character denotes that an object is public - which is available to everyone. If not, then the object is private - which is visible only to users within your own tenancy.
Below is an example of how this works with types and objects
// private type
pritype = ${type:"Person"}
// public type
pubtype = ${type:"#Location"}
// private object
johndoe = ${object:"JohnDoe"}
// public object
gb = ${object:"#LOC_GBR"}
Built-in Variable Typesβ
Scalarβ
A scalar is a single value of either string, boolean (true/false) or numeric
Dateβ
A date variable is a representation of a Date or a Date and Time in the UTC timezone
Durationβ
A duration variable represents a period of time such as 3 days or 4 and a half minutes in ISO 8601 duration format
Objectβ
An object is a very versatile variable type that allows you to add any other variables to it including Object variable types. This creates a dynamic JSON type structure
Secretβ
A secret is a scalar whose value cannot be printed or logged, it only really is useful when used with the Secret Service where secrets can be stored and then retrieved by scripts or workflows. Usually secrets are used to store passwords and database connection information etc.
Calendarβ
A calendar variable type represents an ODSL Calendar. It is used with timeseries, curves and other time-bound resources
Expiry Calendar Variableβ
An expiry calendar variable type represents an Expiry Calendar which is a special type of calendar that uses rules to calculate when trading stops for a future price for a particular commodity
Transformerβ
A wrapper for a data transformer, used with the transformer service
Extractorβ
A wrapper for an extractor, used by the extractor service
Linkβ
A wrapper variable for creating links or relationships between objects
DeclaredTypeβ
A DeclaredType variable is a wrapper for a type and is used by the type service and creating objects
Executableβ
An executable wrapper variable holds either an expression of a method
Voidβ
This is an empty variable used for methods that donβt return a specific variable
Nullβ
Null represents an empty or no value variable
MissingValueβ
A MissingValue is a real variable but it doesnβt have a value yet, it is usually used in TimeSeries to represent a TimeValue in a calendar that has no value
Listβ
A list represents a list of other variables
VirtualList A VirtualList is a list that is paged to improve performance and is used with the find command when listing resources from services
TimeSeriesβ
A timeseries is a list of values which are indexed by dates. A timeseries could be the price of a particular stock recorded at a certain time of each day (say the time that the stock exchange closes)
Smart TimeSeriesβ
A Smart TimeSeries is an expression that is used to build TimeSeries on demand