With Incontrol, it's possible to perform complex calculations. Using the calculation element, you can execute a calculation. By giving the Calculation element an alias, you can easily continue calculations with the result in your form.
How can you add the Calculation element?
Since users do not provide input to the Calculation element while filling out a form, we have placed the element under Static elements. You can recognize it as follows:
How do you add a calculation in the Calculation element?
In the element, you can add values to perform addition, subtraction, multiplication, and division. Below is an example of how this works within Incontrol.
In the first part, the values are specified on the right side. The middle column indicates which alias is assigned to the specified value. In the second part, the Calculation element is used in the right column. On the left, it indicates what is being calculated, and in the middle, the calculation is specified within the element itself.
Below, you can see how the element is set up for adding the values in the above example.
When editing the element, you can specify a Label and Text. For Calculation, you specify the formula, and for Display, you can indicate how your result will be displayed. It can be shown as a number or as time.
How does the display format work?
By default, the result is displayed with 2 decimal places. However, you can choose to show more or fewer decimal places. If you choose 'no display format,' no rounding will occur.
Displaying the result in time
As you can see, you can choose from several different "input in" variants. The result of your calculation will always be a number at the backend. Therefore, Incontrol wants to know if the result is in days, hours, minutes, or seconds. Depending on this value, the correct time can be displayed. Below "input in," you see the values as they are already displayed in the concept and/or document. Below is an overview of the values.
- dd = days
- hh = hours
- mm = minutes
- ss = seconds
Example 1: With an input of 90 hours and an output of HH:mm, it will display as 90:00.
Example 2: With an input of 90 minutes and an output of hh:MM, it will display as 01:30.
Tip 1: If you calculate with values from the date/time element, the input is always in hours.
Tip 2: Give the calculation element an alias so that you can continue calculations with the result.
Where else can I perform calculations?
You can perform calculations and display them as numbers or as time via the calculation element. It's also possible to perform calculations with the following elements or text. Click on the section for more information.
How can I calculate within dynamic content?
It's also possible to calculate within dynamic content. See here how you can achieve this.