> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.robaws.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Smart calculation with parameters in your posts

A [post](https://support.robaws.com/en/article/creating-a-post-ry11o1/) is the reusable build-up of a quotation line. With **parameters** you make that post smart: you ask the question once ("which colour?", "how many days?", "is the site easy to reach?") and the calculation adapts automatically. In this article we build a "Painting work" post step by step, with four kinds of parameters.

Our example contains these cost lines:

| Item | Cost type |
| ---- |
| Working hours | Labor |
| Paint - blue - 10 l | Material |
| Paint - red - 10 l | Material |
| Aerial work platform | Equipment |
| Kilometercompensation | Indirect costs |

![The calculation of the Painting work post](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-1_123pdu1.png)

## 1. A choice parameter: which colour of paint?

The customer chooses blue or red — but only one of the two paint lines may count. This is how you handle that:

1. Open the **parameters** section in the post and create a new parameter with a **unique name**, e.g. `kleurverf`.
2. In the **Description** field, put the question: *which colour is used?*
3. Switch on **"Show details"**. A **"Possible values"** column appears.
4. Enter the values **between double quotation marks**: `"blauw"` and `"rood"`, each one followed by Enter.

![The parameter kleurverf with the possible values blauw and rood](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-2_vbo5po.png)

The parameter now exists, but it does not influence the calculation yet. To do that we link a **condition** to the quantity of the paint lines. The formula

`kleurverf == "blauw" ? 1 : 0`

gives 1 (count it) if blue is chosen, and 0 (do not count it) if red is chosen.

![The conditional formulas as a calculation in the parameter overview](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-3_1g1bxsd.png)

| Tip: the parameters section is also a scratchpad. Put a formula in as an extra record with the "Calculation" tick box switched on and you see the result immediately. Calculation records disappear from the overview as soon as you switch "Show details" off.

Then paste the formula **between brackets** in the **Quantity** field of the blue paint line, after the existing quantity. If it says `1/100` (1 litre per 100 m²), for example, that becomes:

`1/100 * (kleurverf == "blauw" ? 1 : 0)`

Repeat this for the red line with `"rood"`.

![The formula in the Quantity field of the paint line](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-4_1s0btxq.png)

If you now choose a colour, Robaws only counts the correct paint line — the other one is set to 0.

![Only one of the two paint lines counts in the calculation](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-5_1i7z6nk.png)

## 2. A numerical parameter: how many days of aerial work platform?

For a number you do not need "Possible values": create a parameter `aantaldagen` and simply put the number (or a calculation formula) in the **Formula** column. Then paste `aantaldagen` in the **Quantity** field of the "Aerial work platform" line — the value is taken over immediately.

![The numerical parameter aantaldagen linked to the aerial work platform](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-6_r3sp1z.png)

||| On a line like that, also switch on **Totality**: the number of days is then fixed and is no longer multiplied by the quantity (e.g. m²) of the post in the quotation.

Do you also want the choice of *whether* an aerial work platform is needed? Then, just as with the colour, create a choice parameter `hoogtewerker` with the values `"ja"`/`"nee"` and multiply the quantity by `(hoogtewerker == "ja" ? 1 : 0)`.

## 3. Predefined parameters: distance and quantity

Two parameters are always available, without you having to create them yourself:

* `DISTANCE_KM` — the number of kilometres that is calculated automatically on the quotation. Paste this in the quantity of your "Kilometercompensation" line and the travel cost calculates itself.
* `Q` — the quantity of the line itself, useful in formulas that work with the quantity entered.

![DISTANCE_KM as the quantity on the kilometercompensation](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-7_6fyxba.png)

## 4. An experience parameter: calculating what you used to forget

This is where it really gets interesting. A site is sensitive to variables that quietly eat into your margin: how easy the site is to reach, one slow lift for a whole building, limited parking, and so on. Usually you only *know* that afterwards: "we lost a lot of time there."

Pour that experience into a parameter. In your post, create a choice parameter `vlottetoegang` with the question *is there easy access to the floor?* and the values `"ja"`/`"nee"`. Multiply the quantity of your "Working hours" line by a surcharge factor:

`8 * (1 + (vlottetoegang == "nee" ? 0,15 : 0))`

With "nee", your post automatically calculates 15% extra hours. Every following quotation asks the question again — the knowledge sits in the system, no longer in one person's head. Why that is so valuable is explained in [What is a calculated quotation?](https://support.robaws.com/en/article/what-is-a-calculated-quotation-16m9bcl/).

![The experience parameter vlottetoegang with a surcharge formula on the working hours](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-8_1afw2l5.png)

## 5. Parameters as text on your quotation

You can show the chosen values on the quotation pdf automatically. In the **Extended description** of your post, put a reference with `${parameternaam}`:

* Entry in the post: `Kleur: ${kleurverf}`
* Display on the pdf: `Kleur: blauw`

![The reference to the parameter in the extended description](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-9_rk6hyu.png)

You can even make whole sentences depend on a choice. Create a parameter `teksthoogtewerker` with this formula:

`hoogtewerker == "ja" ? "Er zal een hoogtewerker door ons voorzien worden voor " + aantaldagen + " dagen." : "Er wordt een hoogtewerker voorzien door de klant."`

Refer to it with `${teksthoogtewerker}` in the extended description. If the user chooses "ja", the pdf shows: *Er zal een hoogtewerker door ons voorzien worden voor 5 dagen.* With "nee": *Er wordt een hoogtewerker voorzien door de klant.*

![The text parameter with a conditional quotation text](https://storage.crisp.chat/users/helpdesk/website/-/e/a/d/f/eadf6dec760ec000/slimcalculerenmenl-10_1sdgf1j.png)

## Ground rules for formulas

| Rule | Example |
| ---- |
| Text values are always between double quotation marks | `"blauw"`, `"ja"` |
| You enter decimals with a comma | `0,15` |
| Condition-question mark-colon: if ? then : else | `kleurverf == "blauw" ? 1 : 0` |
| In functions with several arguments you separate with a semicolon | `max(Q; 10)` |
| You join texts together with + | `"voor " + aantaldagen + " dagen"` |
| Parameters may refer to each other | `aantaldagen * (hoogtewerker == "ja" ? 1 : 0)` |

The usual mathematical functions are available (including `min`, `max`, `abs`, `ceil`, `floor`, `round`, `sqrt`). In a **quotation parameter** (the parameters tab of the quotation, so across all lines) you can also use `SUM(...)` to add a parameter up across all lines.

| Tip: parameters also work at the level of the whole quotation — one answer then drives several posts at once. You will find them in the "parameters" tab of a [calculated quotation](https://support.robaws.com/en/article/drawing-up-a-quotation-step-by-step-1lq8fnu/).