The component Calculation comes in handy when you want to display a numerical value, that is dependent on other components. Your patient could for example fill in his length and weight, the component then calculates the BMI. Or if you want to calculate the age of the patient based on the date of birth.

In the pop-up on the tab Specific properties you select whether you want to calculate a numerical value or a date/time value. Dependent on your choices the different options will be shown.

__Calculation type Date Time__

With a Date Time calculation you first choose whether you want to Add (+) or Deduct (-). Then, you choose two values, that can be variable or constant dependent on the Operator. It is only possible to use two date fields with Deduct.

**Variable value**

For a variable value you can choose from the current date/time, a specific date/time you fill in, or a component that you select.

**Constant value**

For a constant value choose the amount of days, weeks, months, or years you want to add or deduct from the date/time. After that, you choose the format in which you want to display the date/time. Filling in a minimum- and maximum value and a validation message is optional.

__Calculation type Numerical__

If you chose calculation type Numerical you will see that the entry field where you can fill in the formula will appear. In the formula field you build the desired calculation. Other than the standard calculations such as addition, deduction, dividing, and multiplication you have a few other calculation options. They are described below.

You have different options to use for a calculation. You can choose from the following standard functions:

- Addition: here you use the + symbol.
- Deduction: here you use the – symbol.
- Multiplication: here you use the * symbol.
- Dividing: here you use the / symbol.

Select a numerical component by clicking on *Select component *on the dropdown. Fill in a desired calculation option in the formula field and select another numerical component. Build the desired formula/calculation this way.

Attention! When selecting a numerical component from your template only the ID of the component is shown and not the entire title of the component. The title of the component will be shown under the Formula field, at Example.

Next to the standard functions you can also use other functions. Click on the button f(x) in the option bar above the formula field.

Attention! When selecting one of the functions it is made ready for you in the formula field, you only replace the a, b, etc. with the desired numerical components.

The following options are available:

**Exponentiation:**

Select the function Exponentiation under the f(x) button. The following formula appears: **a^b **

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 to the power of Numerical 2.

**Faculty:**

Select the function Faculty under the f(x) button. The following formula appears: **a!**

Replace the a with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 faculty.

**Modulo:**

Select the function Modulo under the f(x) button. The following formula appears: **a#b**

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 modulo Numerical 2.

**Square root:**

Select the function square root under the f(x) button. The following formula appears: **sqrt(a)**

Replace the a with a numerical component. On the image below you can see the layout of this calculation – in this example we use the square root of Numerical 1.

**Minimum:**

The outcome of the calculation shows the lowest value of all values used in the formula.

Select the function Minimum under the f(x) button. The following formula appears: **min(a,b).**

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 through Numerical 5.

**Maximum:**

The outcome of the calculation shows the highest value of all values that are used in the formula.

Select the function Maximum under the f(x) button. The following formula appears: **max(a,b)**

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 through Numerical 5:

**Average:**

The outcome of the calculation shows the average value of all values that are used in the formula.

Select the function Average under the f(x) button. The following formula appears: **mean(a,b)**

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation – in this example we use Numerical 1 through Numerical 5:

**Logarithm:**

Select the function Logarithm under the f(x) button. The following formula appears: **log(a,b)**

Replace the a and b by a numerical component. On the image below you can see the layout of this calculation – In this example we use Numerical 1 and Numerical 2. We have numerical 1 as base number and numerical 2 as exponent.

**If else statement:**

Select the function logarithm under the f(x) button. The following formula appears: **if(a=1,2,0)**

Replace the a with a numerical component. On the image below you can see the layout of this calculation. In the formula 1 is the value to compare with, 2 the if value, and 0 the else value. This means that if numerical 1 is equal to 90 the calculation will do numerical 1 times 2. Is numerical 1 not equal to 90 then the calculation will do numerical 1 divided by 2.

**If else if statement:**

Select the function Logarithm under the f(x) button. The following formula appears:** iff(a=1,1;b=2,2).**

Replace the a and b with a numerical component. On the image below you can see the layout of this calculation. In the formula for numerical component a, the value to be compared is 1 and 1* the then value. For numerical component b, the value to be compared is 2 and 2* the then value. This means that if numerical component 1 is equal to 90, the component will divide numerical 1 by 2. Is numerical component 1 not equal to 90, then the calculation will look if component numerical 1 is equal to 60, if this is the case then the calculation will do numerical component 1 times 2.

We support way more calculation components. Do you want to use these other functions? Please contact us.

When there are empty values in a MIN, MAX, or AVG calculation, they are ignored and there will be a value calculated. If you want a 0 to be used for an empty value, this can be done. After this you choose the number of decimals you want displayed and if the number is going to be rounded (5,837 - > 5,84) or cut short (5,837 - > 5,83). Finally, you fill in a minimum and maximum value as well as a validation message. These fields can also be left empty.