Creating a formula in a widget allows you to automatically calculate complex data and save your field operators time, while ensuring the accuracy of the information reported.
Example : here we want to calculate the cost of an intervention with the price per hour and the number of people who worked, we will have 3 number widgets containing the 2 previous information and a widgets which will calculate the total.
On this last widget, in the default value to perform a calculation, you must start with calc (, followed by the first tag of your widget, here it is the tag ## tag1 ##. As we want to do a multiplicaton, we will use this character "*" (as in Excel), followed by the second tag of the brick ## tag2 ##.
Which gives the formula calc (## tag1 ## * ## tag2 ##)
👇 Here's how it will look in the app :
💡 GET A RANDOM NUMBER
In some cases you want to get a random number (for example when creating equipment from the app - article on La Brique Equipement).
By selecting fx you can paste the following formula :
calc (random ()) * 1000000))
This will randomly suggest a 10 digit number. Delete zeros if you want a shorter number.
You can combine a Number widget with this hidden formula and use its tag to use it further.
For a number attribute, the parameters allow you to define a maximum and a minimum when creating this attribute. The maximum and minimum must be between 0 and 9999.