Calculations for Order Forms & Custom Calculators

Formsite custom calculatorOne of the many features that makes Formsite popular and powerful is the Calculations item. This item lets form builders perform basic mathematical equations on form answers, then uses the equation result later in the form.

Our Order Form items make building order forms simple and the Calculations item isn’t needed in those cases. If the simple order form items aren’t enough, however, the Calculations item lets you specify a custom equation.

Some uses for calculations include:

  • Adding product options
  • Order additions (tax, shipping, etc.)
  • Scoring calculations
  • Custom calculators

The basic use is to first add your items to calculate, then add the Calculation item where you want it to appear. It will ask you for the equation when you add the item, so you can use the Add item to equation link to see all of your qualifying items.

Making a Calculator

An easy place to start is to make a calculator to determine the area of a rectangle.

  1. Add a Number item labeled ‘width’.
  2. Add a Number item labeled ‘height’.
  3. Add a Calculation item labeled ‘Calculated area:’.

The equation is width * height. Similar to piping, calculation items have their own id numbers that we insert into the equation:

  1. Formsite calculations equationClick Add item to equation
  2. Locate the item you want to add to the equation
  3. Copy the code and click the Close button
  4. Paste or enter the code into the correct place in the equation

If the ‘width’ item has a code of ‘id23’ and the ‘height’ item has a code of ‘id24’, the equation would look like:
id23*id24

See it in action ›

Formsite calculations shipping costUse Scoring to assign values

Calculating basic numbers is easy, but what if you wanted to assign a value to a text option? For example, to set the shipping cost for your order form based on the shipping address State field:

  1. After adding your Shipping Address items, edit the Dropdown item for the State
  2. Click the Calculations tab
  3. Click the box to Enable Scoring
  4. Set the Assign values for: setting to Each choice
  5. Set your shipping costs for the states
  6. Click Save
  7. Add a Calculation item labeled ‘Shipping Cost’ with the equation as simply the id number for the State item
  8. Check the box next to Include in Order Total
  9. Save and test

See it in action ›

Complex Calculations

You can create virtually any calculation as long as the equation uses the basic mathematical operators +-*/. You can group statements using parentheses and insert constants as regular numbers.

Examples:

  1. The order form has 6 products and I want to calculate the total ordered and add a 6% tax:
    (id1+id2+id3+id4+id5+id6)*1.06
  2. The quiz has 5 questions (with values set to 1 for the correct answers) and I want to display the percentage correct:
    ((id1+id2+id3+id4+id5)/5)*100
    Note that you can set the Calculation item to show 0 decimal points and provide the ‘%’ suffix to show the percentage as a formatted score.
  3. Automatically apply a discount based on the order total. See where we’ve covered this before.

10 thoughts on “Calculations for Order Forms & Custom Calculators

  1. This is great! But … how do I add a shipping charge to some – NOT all – items? Also, what if I wanted the shipping amount to change, based on item ordered?

    With as amazing as Formsite is, you MUST have an easier way to assign chipping charges!!!!

    • If the shipping charge is fixed but dependent on which items are ordered ($5 shipping for up to 10 items, for example) then you can add your Radio Button Pricing item with a rule to show based on the selected items. If you want it to change, simply add all of the shipping options and set rules to display when the conditions are right.

      If the shipping charge is a percentage of the entire order, you would add the Radio Button Percent item instead and add it like a tax.

      Does that answer your questions? If not, please drop us a line on our customer support page.

    • It’s not possible to use dates in calculation equations, unfortunately. We have added date calculations to our development consideration list for a future release. Thanks!

  2. I am selling tickets to an event – one ticket costs 80$ but if you buy two tickets the pair costs $150. I want to cap the number of tickets sold at 150. I am using radio button pricing with the two pricing options and want a calculation to count the total number of tickets sold for the event (so all results) and when the number reaches 150 for a “Sold Out” notification to appear and the sale to stop/not go through. How do i do this?

    The info above seems to calculate with one record/transaction.

    Thanks!

    • There are two parts to your question: How to discount the 2nd ticket and how to limit the total to 150.

      There are several ways to discount the 2nd ticket, but considering that you want to limit the available tickets to 150 I’d do it this way:

      1. Add a Text Quantity item labeled “Qty”, then set the max to “2”
      2. Add a Radio Button Pricing item labeled “Tickets”, then set one option labeled “$80 for 1, $150 for 2”, then click the Inventory tab and set the total inventory to 150
      3. Add a Calculation item labeled “Discount”, set the equation to -10, set the Prefix to “$”, then check the box at the bottom next to “Include in Order Total”
      4. Click the Calculation item’s Rules tab and set a rule to show when the Quantity item is “2”
  3. Is there a way to have a running total calculation on a form, without the “calculate” button?
    I would like to just have the total automatically update.
    Is this possible?

    • There isn’t a built-in way to do that, no. The calculation needs an ‘event’ to process the equation and currently that’s the page load or the button click.

      You may be able to add a Custom Code item to your form and add the necessary Javascript or jQuery to do that.

Leave a Reply

Your email address will not be published. Required fields are marked *