Evaluate Data types & Dynamic Note
Last updated
Last updated
Note: The Evaluation item type used to be called 'Calculation' but had been replaced by 'Evaluate' item types.
The Calculation property in TilliT is available when using Evaluate Boolean/Text/Number or Read only note. However, the same tool is also integrated in the item properties Active item & hidden expressionsalongside Tolerances.
Calculations with Evaluation item type can be as simple or as complex as you need them to be. You can use either mathematics or JavaScript. If you're not familiar with JavaScript, a good source to get started with is W3 Schools.
To calculate variable values, you can reference elements in the form, using the item key, and you can also reference attributes. When you open the calculation tool, these will be listed. Simple click one and it will be added to the calculation.
However, it is important to note that depends on the Evaluation type that you choose, the system will expects the result of the calculation to be of that type. (Text, Number or Boolean)
In the following example, we are using a Evaluate Number data type.
Click on the calculator icon next to the field Calculation.
In the first screenshot, below, the attribute 'Bottle Volume' will be multiplied by 6. In this example, the value of Bottle Volume is 750.
The second screenshot is from the activity from the operator's perspective, which is shows the result of the calculation.
If you're comfortable using JavaScript in your calculations, you can unlock a lot of extra functionality within TilliT. In the example below, we are using the Read only note data type. The calculation is an optional section of Read only note. You can simply use the Name or Hint property to write your note. However, using the Calculation property allows you to write more dynamic notes.
In the first screenshot, the note is made of 3 parts. The first part is a text string, written within quotations. We then add the attribute Closure Type, which is has a text value, but you can use number and Boolean types as well. Booleans will be parsed as text string (stating true or false).
Finally, we add another text string to finish the statement.
In our example, Closure Type has a value of "Cork", so the result of our calculation above becomes:
This work on a calculation in the same way. The only difference would be a Data Type of Calculation, with the different card in the activity form: