To add a field to a formula you can click on the “Add field” button
Depending on which kind of formula you add a field different pieces of information will be used.
For example, if you have a text field which has a fixed price of 10 (as defined in the price type setting)
If you add this field in a “Price” formula, its “Price” representation will be used, in this case the 10. But if you add it in a formula to define the text of another field, then its textual representation will be used, which is going to be whatever text the user typed in it.
Using context functions
Some of the fields have additional functions, for example, the dropdown has functions to return the text of the selected items or their price. You can find the list of available functions by adding a field and then adding a dot in front of them
A context menu will pop up that will give you a list of available functions for that field, in the example above i can see a list of available functions for the dropdown.
Clicking on them or hitting enter will add the function to the formula.
You might want to get values from the URL for example you might have a URL like this:
And you might want to fill a field using the value of myparameter (in this case it would be “hello”)
To do so follow these steps:
1.- Select the field that you want to fill with this value and open the formula editor
2.- Click on “Add function”
3.- Select the function “GetParameter”
4.- Configure the function, this function just needs the name of the parameter that you want to use, in my previous example (HTTP://www.example.com?myparameter=hello) my parameter is called “myparameter” so I will use that
That’s it! Now the field that I selected will be automatically filled using the parameter from my URL.
Sometimes you will want to add conditions to your formulas, for example you might want to use different calculations depending on what options in your form are selected.
The condition above will check the value of the dropdown, if the “Option 1” is selected the formula value will be 1, otherwise it will be 2.
The else section is optional, if you want you can create many conditions like this:
In the example above the formula value will be 1 if option 2 is selected, 2 if option 2 is selected or 3 if option 3 is selected.
You can also do arithmetical operations inside the conditions for more complex calculations:
Creating multiple comparisons
You can also create multiple comparisons using && (for and) and || (for or). In an “And” comparison all the comparisons need to be true in order for the condition to be executed in an “Or” comparison at least one comparison needs to be true.
for example, if you want to compare if a number is greater than 10 AND lesser than 20 you can use this comparison:
alternatively, if you want to compare if a number is either 10 or 20 you could do so using the “Or” comparison