Prerequisite: to manage the calculated metrics, you must have the role of Functional Administrator in io-base.
Access the Formulas module (menu available from the portal home page).
The editing of a formula is accessible from the edit button in the Action column.
From the edit screen, you can disable or enable a formula (click here for further information).
You can also change the settings of the formula.
Note: it is impossible to modify the name of the calculated metric, as well as the metric database. To do this, you must delete the formula and recreate it.
The screen for editing a formula is divided into three parts:
definition of the metric that will be added to the database
setting up the periodicity for calculating the metric's values
writing the formula for calculating the values
Once the information has been changed, click on the Update the Formula button. For the button to be available, the formula expression must be tested and valid.
Definition of the metric
The Definition zone allows you to modify the general information on the calculated metric:
Name of the metric: cannot be modified
Database: the database in which the metric is, cannot be modified
Description: allows you to give indications on the metric
Unit: unit of the metric values
Calculation periodicity
The Periodicity field allows you to define the frequency with which the metric values will be calculated. There are three possible options:
Continuous: the values will be calculated continuously, if a value of a metric used in the formula changes.
Simplified: allows to define a number of seconds/minutes/hours between the calculation of two values
Advanced: allows you to define a more complex frequency, using "CRON Expressions". A help link is available on the screen, to help you write this frequency.
To summarise, the frequency will be defined by 5 characters.
minute
hour
day of the month
month
day of the week
Special characters can be entered:
* : any value
, : value separator for a list
- separator for a value range
/ : step value
Example: 50*8* means "At 00:05 in August".
Note: For simplified periodicity, it is not possible to enter a value below 10 seconds.
Please also specify the timezone you want to configure for your formula.
An autocomplete feature is available: simply start typing, and the available timezones will be displayed :
When entering your data, begin by specifying the continent, followed by the capital (or economic capital) of the country, separated by a slash (/).
examples :
Defining the formula
This area was made to define the formula that will be applied to calculate the values of the new metric. It contains the following fields:
Data validity in seconds: This value ensures that the calculated values are based on valid data.
For example, if the expression is main@tag>5, and the validity time is 60 seconds. When the formula needs to recalculate, it will look at the date of the last value in base for main@tag. If this date is older than 60 seconds, then the value is considered unreliable. The formula will not be recalculated, and no new value will be inserted for the moment.
If you want to recalculate a value every time, and ignore this feature, just put 0 in this field.
result type: indicates in which format the calculated values will be stored in the database:
BOOL : boolean
INT : integer
REAL : decimal
expression: this is the field that will contain the formula.
You can type directly into the text box, or use the various buttons to help you.
With the Search Metric button, you can search for an existing metric in the database to avoid typing it.
The buttons below show the list of operators that can be used in the expression.
The ? button available on the Expression field gives you additional explanations on how to enter a formula.
Once you have entered your formula expression, you need to test it by clicking the Test Expression button. If the formula is correct, the expression field will be framed in green. Otherwise, it will be red.
Example of a valid expression :
Example of an invalid expression :
If the expression is invalid, by passing the mouse over the red circle ? , an indication appears to explain where the error comes from.
The Erase button allows you to clear the content of the Expression field to start the input again.