Formulas are what separate the calculator from a regular form. They transform what the user inputs into the calculator into a result that helps them in some way. For example, the user will enter their age in a Number field, and the Formula field will show how many years until they retire (Formula would be something like: 65 - @Age)
Note: Formulas don't start with the equal sign (like in Excel), it's not "=65 - @Age", but just "65 - @Age"
Here are the elements you can use in a formula:
Numbers can contain digits or the decimal point (no commas or spaces).
Note 1: You can't use decimals like .5 it has to be 0.5
Note 2: You can only use the dot as a decimal point, no comma anywhere in the number: 1,000 or 2,5 will not work
Just like an Excel or any other Math formula, you use operators to calculate something.
For example, you can write
This is where the formulas get powerful. Every question in the calculator has a numberic value at all times. You can use the question values in your formula to calcualte something meaningful, for example:
Sooner or later you will need functions to calculate anything more meaningful.
Some examples of functions are IF, OR, AND (most of the functions you may be familiar with from Excel will work)
For example in our years until retirement example, you may have a different retirement age based on the person's gender. So you can add a Radio Buttons field called Gender that has 2 options (Man: value=1, Woman: value=2).
Now the formula will be:
When editing a formula you will see two tabs above the formula editor: Variables and Tables.
Variables are a way to store a formula that you can use in other formulas. So for example you can have a variable called Variable1 that is:
You can store data in tables that work similarly to Excel. Then you can use those tables in your formulas. Learn more about Tables.