Formula language

Gabriele Carcassi edited this page Mar 6, 2015 · 4 revisions

The framework supports a small formula language that allows to perform real-time computation on the data from different channels. All functions are registered as extensions which makes the language extensible. Each function so The language is extensible as it allows to register custom functions.

As single channels are most common, proper formula start with '=', while everything else is interpreted as a simple channel.

Simple channels

Any string of text that does not start with = or ' is considered a channel:

mychannel123    : the channel called "mychannel123"
mychannel+123   : the channel called "mychannel+123"
123             : the channel called "123"

Channels can also be escaped in single quotes:

'mychannel123'    : the channel called "mychannel123"
'mychannel+123'   : the channel called "mychannel+123"
'123'             : the channel called "123"


Any string of text that starts with = must be followed by and expression.

Channels in expressions must be single quoted:

='mychannel123'    : the channel called "mychannel123"
='mychannel+123'   : the channel called "mychannel+123"
='123'             : the channel called "123"

Escaped text is supported within the single quotes with the same definitions as in Java. For example \n for new line, " for double quotes, ' for single quotes and so on.

Expressions can contain numeric and string constants. Their definition matches Java.

="Some text"   : a constant string
=123           : the constant integer 123
=3.14          : the constant double 3.14
=1e5           : the constant double 100,000 in exponential notation

Expressions can be combined with operators and functions.

=1000 * 'mychannel' + 300   : the value from a channel called "mychannel"
                              multiplied by 1,000 and summed to 300
=log('mypchannel')          : the logarithm of the channel called "mychannel"
=arrayOf(1,2,3,4,5)         : an array containing the first 5 integers

Function reference

Since operators and functions can be added dynamically (some are added by support for a particular datasource) we can't provide a full list here. It would also become out of date with each release. The Formula Function Browser is a JavaFX tool that allows to see the list of all the registered function

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.