Formstack

Creating Calculations

Self-calculating form fields are handy for order forms or anywhere that you might need to compute a value based on what users select on your form.

To create a calculating form field, first, create a Short Answer or Number field, then look for the Use Calculation link underneath the Default Value area.  Click on that link, and you will see a drop-down list of fields, numbers, and mathematical symbols that you can use to setup the calculation.

Select a field from your form and use the operator buttons to the right in order to create an equation.  For example, if you are selling multiple products across separate fields, you could set the calculation to be the sum of the appropriate fields.

For more information on how to use the calculation builder check out this support doc.



Using Separate Values
When using select lists, checkboxes and radio buttons, you can check the box that says "Use separate values".  This allows you to add a number or text value to each option in the field.  This can be used in many different ways, but here is one example:

Say you wanted an order form where people could order different types Back to the Future props. You could add a select list field called "What prop would you like to purchase?" to your form with multiple prop options. Click on the field, then on the "Advanced Options Editor" button in the left column. Check the box that says "Use separate values" and assign a number value to each option, i.e. 5 for "Hoverboard"; $20 for "Flux Capacitor" and so on.



When you insert this field into a calculation, it will insert $5 into the calculation when the user chooses "Hoverboard"; $20 into the calculations with the user chooses "Flux Capacitor", etc.

Date/Time Field Calculations
Date/Time fields can now be used in the creation of calculations! For a full walkthrough on how to create these kinds of calculations our full walkthrough can be found here
Notes: 
- You will see an error when using option values that are the same, such as setting two different items as both being $5.  This is because option values must be unique.  To get around this, you can set one item to $2, one to $2.0, one to $2.00, etc.  While these are all technically the same number, 2, the form builder sees them as unique values and will allow you to use them.
- When you opt to use separate values, you have the option to save just labels, values, or both in your database. Whatever is saved will be displayed in the Notification/Confirmation Emails as well. For example, if the values are purely for calculation and you just need the label saved and displayed in the emails, you'll need to either opt to save labels AND values (both) or just labels if you don’t need the values.
- If you intend to use Email Logic for Confirmation or Notification Emails, based on the field Values you will need to ensure that each Value is different.  For example, Values of 2, 2.0, 2.00, etc. will be seen as "2" by the Email Logic so any message with these Values will be sent.  To prevent this from happening each Value will need to different, such as 2, 3, 4, etc. for the Email Logic to successfully distinguish the Values.