Pro, Business and Enterprise plans
If you need some examples to help you better understand calculations, we've got you covered. In this topic, we'll cover three different types of calculations.
A basic ticket price calculation
Kate is using a form to sell tickets to a street party. People can buy as many tickets as they want. She wants to use a calculation to work out how much her responders should be charged for their tickets.
Kate adds a number field to her form. People will use this to enter the number of tickets they want to buy. She gives the field a default value of 1.
Then she adds a calculation field to her form. This will be used to calculate the amount a responder will be charged.
Kate goes to the dropdown menu in the calculation and chooses to add a Number, calculation or date field. She selects How many tickets do you want?, which is the name of her number field. She presses Insert. Her number field is added to the calculation.
Kate is selling 1 ticket for $50. Because she wants to calculate the total cost of all tickets, she should multiply the number of tickets by 50.
She types *50 into the calculation. * is the symbol for multiplication, so she is multiplying the How many tickets do you want? field by 50.
Finally, she adds a payment field to her form.
She wants to Use a calculation field to determine how much to charge, so she selects her calculation field (calculation) from the menu.
Kate’s final form looks like this:
An advanced variable calculation
Sam works for the local government. He’s making a form for people in the community to register their pets, so they have a better chance of being found if they get lost. He wants to use a calculation to work out how much his responders should be charged based on the kind of pet they have.
Sam adds a radio button field to his form. People will use this to select their pet type.
Sam adds another radio button field. People will use this to say if their pet is microchipped or not.
Then he adds a calculation field to his form. This will be used to calculate the amount a responder will be charged.
Sam goes to the dropdown menu in the calculation and chooses to add a Variable. He selects What kind of pet do you have?, which is the name of his first radio button field. He presses Create variable.
Sam can now configure the value for each pet type.
He wants it to be more expensive to register dogs and reptiles, so he sets their value to 30 and the others to 20.
Sam’s local government has a rule that all cats must be microchipped. Because of this, Sam wants to make it more expensive to register a cat that isn’t microchipped. The extra fee will cover the cost of the microchip.
He chooses the Register and pay section from the Section menu, then chooses Is your pet microchipped? from the Field menu. He sets the answer to No, then presses Add. He gives his new rule a value of 30.
His new rule means that if someone has a cat and their answer to Is your pet microchipped? is no, the value will be 30.
He clicks Advanced next to the ‘Cat’ option to set a special calculation rule for cats.
If they have a microchipped cat, the value will be the standard 20.
Sam clicks Save to save his rule.
Finally, he clicks Create and insert to add his custom configuration to the calculation.
To finish his form, Sam adds a payment field.
He wants to Use a calculation field to determine how much to charge, so he selects his calculation field (Payment calculation) from the menu.
Sam's final form looks like this:
A calculation using functions
Louise is running a food truck festival, and she's making an application form for vendors. If the vendors don't have their own food truck or marquee, they can hire one or both. It's expensive to hire a food truck, but not as expensive to hire a marquee. If a vendor wants to hire both, Louise only wants to charge them for the food truck.
- Louise adds a radio button for vendors to choose if they want to hire a food truck.
- She also adds a radio button for vendors to choose if they want to hire a marquee.
- She adds a calculation field. This will be used to calculate how much a vendor should be charged based on their responses to the previous questions.
- Like Sam in the previous example, Louise creates a variable for the Do you need to hire a food truck? field. She sets the 'No, I'll bring my own' value to 0 and the 'Yes' value to 700, because it will cost $700 to hire a truck.
- She creates another variable for the Do you need to hire a marquee? field. She sets the 'No, I'll bring my own' value to 0 and the 'Yes' value to 75, because it will cost $75 to hire a marquee.
- Louise doesn't want to add the values of both radio fields, because she doesn't want to charge someone who hires a food truck extra for a marquee. Instead, she wants to find the maximum value that the responder has selected, so they'll be charged for the food truck OR the marquee, but not both.
She types max( , ) into the calculation, enclosing the two variables in the brackets, and separating them with the comma. The calculation will take the maximum value from the two radio button fields.
She doesn't want her calculation to appear on her published form, so she opens the calculation field settings
and selects Always hide
from the Display logic
- Finally, she adds a payment field to her form.
She wants to Use a calculation field to determine how much to charge, so she selects her calculation field (Payment calculation) from the menu.
Louise's final form looks like this:
Need to know more about calculations? Visit Use calculations.