Using Formula to scale values and update units

Using Formula to scale values and update units

@Fabioer

Formula is a cool function that the widgets contain in order to give more options to display your data. When you apply Formula it never changes the variable in the bucket, only the presentation.


You can do simple things as math, filters, and conditions. For example: if the unit of the temperature is stored in °C, convert to °F. Or if a value is given in Km you can apply a formula to display it in meters. Documentation is here: https://help.tago.io/portal/en/kb/articles/225-formula

One nice tip is to select the best origin of the Unit when using Formula. One option is to display the Unit from the variable that contains the formula, so that the Unit present is dynamically adjusted. For example, if you want a dial to present value in °C or °F based on a selection from the user, you can create variable that contains the equation, and use this variable as the source of the Formula:

Then, to go the field Unit Origin and select the option ‘Unit from variable used in the Formula’.

So that when the user change the selection of the Unit, the gauge widget will show the temperature in the right value with the correct unit, as showed below.

In the image above, you can noticed that Display#1 doesn’t change because it is showing the original value of the variable without Formula. Only the gauge changes its value and unit because of the Formula - you can noticed the f(x) on its top right location.

There are infinity possibilities to use Formula, let us know how you use it.
Cheers!