Introduction

The AI Calculations feature is an agile tool designed to streamline your forms. We've combined the robust capabilities of the Calculation field with AI, creating a powerful solution that's efficient and intelligent. Say goodbye to manual calculation setups and hello to smarter, quicker, and more effective forms.

This guide assumes you know how to add a Calculation field to your form. If you’re not yet familiar with Paperform’s Calculations field, check out our Calculations Guide to get across how they work and the many ways you can use them.

Using the AI Interface

AI-generated Response

To create a calculation using AI, simply type you instructions into the chat box. The AI will respond with:

  • A calculation formula suggestion

  • A preview of the result

  • An explanation of how the formula works

    AI generated response

Here's a breakdown:

  • Calculation Formula — The AI generates a formula that you can review and apply to the Calculation field. It includes inline comments, indicated by double slashes (//), to briefly explain each part of the logic.
  • “Result” preview — Highlighted in gold, this section shows an example of what the formula will output. It may use data from the most recent form submission.
  • Step-by-step Explainer — Located below the Result preview, this section describes how the formula works, step by step, in plain language.

Refining the Output

If the suggested formula isn’t quite right, you can:

  • Provide additional instructions in the chat box to have the AI revise the formula.
  • Click “Apply” to transfer the formula to the Calculation editor and make manual changes yourself.

Once the formula is in the editor, you're free to modify it directly—or prompt the AI again for changes based on the existing formula.

Read on for tips on how to create effective prompts.

Prompting the AI

If the AI isn’t quite giving you the results you are looking for, you may want to look at how you prompt it. You can think of prompting as providing clear instructions or guidelines to help the AI understand exactly what you're aiming for. By carefully wording your prompts, you're guiding the AI toward generating accurate calculations and results tailored specifically to your needs.

Here are some tips for writing good prompts:

  • Mention the question titles or question IDs explicitly. For example, “Add the cost of selected items for the ‘Pottery’ and ‘Branded Merch’ product fields.”

  • Be specific about the outcome you want. Avoid ambiguity. For example:

    • Instead of “Stop the form from being submitted if they don’t accept the terms.”
    • Say “Display an error message if a user selects ‘No’ on the ‘Terms and Conditions’ question.”
  • If building a calc for logic, be specific about your logic operators.

    • For example, “If the quantity of ‘How many t-shirts?’ is greater than 5, then apply a 5% discount.”

Check out the Examples section for insights on how good prompting can be used to achieve a variety of common use cases.

Troubleshooting with the AI

Use the “Fix” Button

Fix and Format UI in the AI calculations interface.

Even with the help of AI, calculation errors can happen—whether due to unclear prompts, complex logic, or small syntax issues. The AI interface offers built-in tools to help you fix common problems easily!

If your calculation isn’t working and an error appears in the Live Preview, try using the Fix button in the AI interface. This tool automatically attempts to resolve any syntax or logic errors it detects in the formula.

Live Preview Error message in the Calculations Editor.

Use the “Format” Button

Sometimes a formula works fine but is hard to read or edit—especially after multiple revisions. In these cases, use the Format button to reformat the calculation for better readability. This button restructures the formula into a cleaner, more organized format while keeping the logic intact.

Test the Live Form

If your calculation looks correct but you're still not getting the expected result, try publishing your form and testing it in the Live version. The Live Preview is helpful, but the published form provides the most reliable context for how calculations behave with real input data.

You can run a quick test to make sure the AI-generated calculation works as expected. To do this:

  1. Open the Question Panel for your Calculation field.

  2. Make sure the “Hide this question” option is turned off. This allows you to see the output of the calculation directly on the form during testing. Highlight of the "Hide this question" option in the OFF position.

  3. Go to your Live form and test to make sure the Calculation behaves as intended.

This is a useful step especially when extracting values, applying conditions, or combining logic across multiple fields.

Get help! If you’re still not getting the answer you want, you can always reach out to support@paperform.co and our team will be able to point you in the right direction.

Examples

Example 1: Extract Values from a Text Field

You can use AI Calculations to extract specific parts of a text input—such as separating a full name into first and last names. Here's an example of how to do it using a text field that captures a respondent's full name called "Your Name".

Step 1: Extract the first name

For the first calculation, we are going to extract the respondents first name from the Your Name field.

  1. Open a new calculation and within the AI interface, use a specific prompt such as:

    “Extract only the first name from the ‘Your Name’ question.”

  2. Click Send.

GIF of text being entered into AI Chat Interface
  1. Once you are happy with the AI suggestion, click “Apply”.
  2. Review the calculation in the editor. The Live Preview should display an example output. You can also Publish the form and test the calculation with real input on the live form.
View of the applied calculation and AI Calculations modal to extract the First Name.

Step 2: Extract the Last Name

Next, we will use a second Calculation Field to extract their last name.

  1. Duplicate the Calculation field that extracts the first name and title it appropriately.

  2. In the AI interface, use a prompt like:

    “Modify this calculation to extract only the last name from the Your Name question.”

  3. Once you are happy with the suggested changes, click “Apply”.

Now, the duplicated field will be updated to extract only the last name.

View of the applied calculation and AI Calculations modal to extract the Last Name.

Step 3: Testing

Now that you have two Calculation fields where one outputs the First Name and the other outputs the Last Name of the respondent, we can run a test to make sure that the AI-generated Calculation is what we were looking to achieve.

Make sure to go into the Question Panel for both of the Calculation fields and disable the Hide this question option. This will ensure that the Calculation field is visible on the Preview or Published version of the form.

Lastly, test your setup, open the form in Preview or Published mode and enter a full name (e.g., John Smith) into the Your Name text input. Then, verify that:

  • The First Name calculation field correctly displays John.
  • The Last Name calculation field correctly displays Smith.

This ensures both calculations are functioning as expected based on the full name input.

Example of the Text field with values with the Calculation fields displaying the First and Last name.

Example 2: Display an error message conditionally

Use AI Calculations to trigger an error message based on specific conditions—such as when a respondent enters an email from a free provider like Gmail or Hotmail. Here's an example:

Step 1. Create a new calculation question with the title Block common free email providers directly under your email question field.

Step 2. Enter a prompt to display an error message and prevent form submission when a free email provider is used.

Prompt for AI Calculations to display an error when using a free email domain.

Step 3. Click the down arrows to view either the complete calculation or explanation.

Highlighted buttons to show more of the AI-generated calculation and the steps taken by the AI to generate the calculation.

Step 4. Click the Apply button to accept the calculation and move it to your calculation input panel.

Image of the applied AI-generated calculation in the Calculation field.

Step 5. Publish and test your live form with Gmail, Hotmail, and business domain email addresses.

Image of the AI-generated calculation that displays an error message when a free email domain is used.

Example 3: Apply Conditional Discounts Based on Quantity

In this example, you'll use AI Calculations to apply a 10% discount when a customer purchases more than two products—perfect for incentivizing larger orders through automated logic.

Step 1. Create a new Calculation field titled Multiple Product Discount.

Tip: You can choose to display the discount on the form, or keep the field hidden and use the result in your Custom Pricing Rules to adjust the final total behind the scenes.

Step 2. Prompt the AI to generate a calculation that applies a 10% discount if more than two products are selected.

Prompt for the AI to generate a calculation to apply a 10% discount if more than 2 total products are selected.

Step 3. Click the Apply button to insert the AI-generated calculation into the editor.

AI Calculation field with the applied AI-generated calculation.

Step 4. Use the result of this calculation in your Custom Pricing Rules to subtract the discount from the total, only when it’s greater than zero.

Applying logic to the Custom Pricing Rules to use the Calculation field to the form's total.

Step 5. Publish your form and run a test to make sure the discount is being applied as expected:

  • Test 1: Select 2 products → No discount applied No discount added from the Calculation field due to only selecting 2 items.

  • Test 2: Select 3 of the same item → 10% discount applied 10% discount added from the Calculation field due to selecting 3 of the same item.

  • Test 3: Select 3 different products → 10% discount applied 10% discount added from the Calculation field due to selecting 3 separate items.

Gotchas

  • If you're not getting the results you expected, try rephrasing or clarifying your prompt. The AI relies on the information you provide to generate accurate and relevant calculations, so even small changes in wording can lead to better outcomes. Be as specific and descriptive as possible about what you're trying to achieve.
  • While the tool can help generate and apply calculation logic quickly, it may not always produce perfect or fully optimized results, especially in more complex or highly specific use cases. You should still review, test, and adjust the output as needed to ensure accuracy and alignment with their form goals.