Category / Section
9.4 Set Valve Based On User`s Selection
Published:
Updated:
An often used scenario in a form is having the user select between various options and then setting a specific value based on that selection.
In this simple example we sell two types of merchandise, type A and type B. The price of A is 10, and B is 20. We set this up in the form as follows:
In the Preview panel this setup looks like this:
In the Decimal element Price we use the following formula:
The values a and b of the element select_type are initially set to False/0. When one of them is selected, this is set to True/1.
When for instance B is selected, this formula calculates the Price to be 20. You can then use that Price value to perform other calculations, such as adding VAT.