Skip to main content
All CollectionsBuild & customizeForm logic & calculations
How to use logic & calculation basics in Formaloo
How to use logic & calculation basics in Formaloo

Understanding logic basics: simple edits, advanced for complex cross-field and multi-conditional rules.

Updated over 2 months ago

Formaloo’s Logic and Calculation tools allow you to create dynamic, responsive forms that adapt based on user inputs.

By understanding both basic and advanced logic, you can customize the flow of your forms, improve user experience, and collect more relevant data.

In addition, using calculations within your forms enables you to automate simple or complex mathematical operations, making your forms smarter and more efficient.

What is Logic

In Formaloo, logic enables you to control how a form behaves based on the answers provided by users.

logic

You can set conditions that trigger specific actions depending on the responses, making your form more interactive and tailored to each participant. Logic can be applied in two ways:

  1. Basic logic: Simple rules based on individual question responses.

Basic logic example with Formaloo
  1. Advanced logic: Complex rules involving multiple conditions, cross-field logic, and calculations.

Advanced logic Formaloo

Components of Logic in Formaloo

To understand logic better, let’s break down the key components:

  • Rule: A logic rule consists of a condition and an action. The rule defines what happens when the condition is met.

  • Condition: A statement that evaluates to true or false. This can include one or more conditions, chained together using AND/OR operators.

  • Action: The behavior that occurs when a condition is met. For example, showing a new question, jumping to a different field, or submitting the form.

GIF of advanced logic with Formaloo

Types of Logic

  1. Basic logic

    • Ideal for creating simple question flows where the next question depends on the previous answer.

    • Example: If the user selects “Yes” for the question “Do you have any dietary restrictions?”, show a follow-up question asking for details. If they select “No,” skip to the next section.

  2. Advanced logic

    • Unlocks the ability to set more complex rules that can reference other fields and involve multiple conditions.

    • Example: If the user’s age is above 18 and they have agreed to the terms, allow them to proceed to the next step. Otherwise, display a message informing them they need to meet the requirements.

Default Logic

Two types of default rules help maintain the form’s behavior when no specific conditions are met:

  • Always: This rule is followed unconditionally, such as always jumping to a specific field.

  • Otherwise: This rule acts as a fallback when no other conditions are met.

What is calculation

In addition to logic, Formaloo allows you to use calculations to automate mathematical operations within your forms.

Whether you need to calculate totals, averages, or custom values based on user inputs, calculations make the form smarter and more functional.

How to set up logic & calculations

Imagine you're building an online order form where customers can select items and automatically calculate the total cost based on their choices.

Follow this step-by-step guide to set up logic and calculations in Formaloo.

Example 1: Calculating the average score in a feedback form

In a feedback form, you may want to calculate the total score based on several ratings provided by users.

This example will guide you through summing multiple score fields to get a total score and displaying that total using answer piping.

Scenario

Imagine you have a feedback form where users can rate their experience in three areas:

  • Rating 1: Experience with customer service (0-10)

  • Rating 2: Satisfaction with product quality (0-10)

  • Rating 3: Shipping speed (0-10)

At the end of the form, you'll want to calculate the Total rating, which computes the average of the three ratings.

Step 1: Create a feedback form

Start by creating a feedback form with three score fields where users can rate their experiences from 0 to 10.

  1. Field 1: Rate your experience with customer service (Q1)

  2. Field 2: Rate your satisfaction with product quality (Q2)

  3. Field 3: Rate the shipping speed (Q3)

add rating field

Step 2: Add a variable field for total score

Next, add a Variable field to store the total score, which will be calculated based on the user responses.

Assign an ID to this field for reference.

  • Field Name: Total rating

  • ID: total_rating

Variable fields allow you to store values calculated from other fields. In this case, the total score will aggregate the ratings from the three score fields.

Step 3: Add logic to calculate the total score

Now, let's set up the logic to calculate the total score based on user responses.

Follow these steps:

  1. Go to the Logic tab in your dashboard.

  2. For Q1: Add this logic:

    • If Q1 is answered, add Q1 to Total Rating.

  3. For Q2: Add this logic:

    • If Q2 is answered, add Q2 to Total Rating.

  4. For Q3: Add this logic:

    • If Q3 is answered, add Q3 to Total Rating.

add logic and calculation

This logic ensures that the total score is updated based on the responses given by the user for each rating.

Step 4: Display the total score using answer piping

To show users their total score after submitting the form, you can use answer piping. Here's how:

  1. Add a Content field to the success page of your form.

  2. Use answer piping to display the calculated total score:

    • In the content field, type:
      "Your total score is: @total_rating or use {{total_rating}}"

This way, users will see their total scores after submission, enhancing their experience by providing immediate feedback on their ratings.

Example 2: Personality quiz

In this example, we’ll create a personality quiz that redirects users to a result page based on their dominant personality type score.

Scenario

Imagine you are building a personality quiz with four possible personality types:

  • Personality Type A: Socializer

  • Personality Type B: Innovator

  • Personality Type C: Observer

  • Personality Type D: Adventurer

At the end of the quiz, users will be redirected to a page that matches their highest-scoring personality type.

Step 1: Create the quiz form

Start by creating a quiz form with a series of questions. Each answer will be associated with a particular personality type and given a score.

personality quiz

For example:

Question 1: When making a decision, you:

  • Option 1: Weigh the pros and cons carefully. (Personality Type A)

  • Option 2: Trust your gut feeling and intuition. (Personality Type B)

  • Option 3: Seek advice from others. (Personality Type C)

  • Option 4: I like to have all the information before making a choice. (Personality Type D)

Repeat this process for all the quiz questions, assigning each option to one of the personality types.

Step 2: Add variables for each personality type

Next, create a variable field for each personality type to store their scores.

Assign IDs to these fields for reference and a zero default value.

variable field
  • Field name: Socializer | ID: socializer

  • Field name: Innovator | ID: innovator

  • Field name: Observer | ID: observer

  • Field name: Adventurer | ID: adventurer

These variables will accumulate scores for each personality type based on the user's answers.

Step 3: Add ending pages for each personality type

Create a separate ending page for each personality type to display the results to users. These pages will provide personalized feedback based on the user's highest score.

success pages

Use the default success page for the first personality type and create new ending pages for other personality types (in this example, you should create 3 more ending pages).

Don't forget to add a title for each ending page to use them in the logic settings later.

Step 4: Add logic to calculate personality scores

Now, set up the logic to calculate the scores for each personality type.

For each quiz question, add logic that increases the corresponding personality score depending on the user's answer.

add logic and calculation

For example:

  • If the user selects "Weigh the pros and cons carefully" in Question 1, add 1 score to the Socializer.

  • If the user selects "Trust your gut feeling and intuition" add 1 score to the Innovator, and so on for each question and its respective personality type.

Step 5: Add logic to redirect based on the highest score

After calculating the scores, you need to add logic to compare the final scores and redirect users to the appropriate personality type result page.

logic on submitting the form

For example:

  • If the Innovator is the highest, After submitting go to the Innovator ending page.

  • If the Observer is the highest, After submitting go to the Observer ending page.

  • If the Adventurer is the highest, After submitting go to the Adventurer ending page.

Now add the last step in the "Otherwise" condition:

Otherwise, after submission go to the Socializer ending page.

This ensures that the user is redirected to the correct result page based on their highest-scoring personality type.

By combining logic and calculations in Formaloo, you can create powerful, personalized forms that not only adjust dynamically to user responses but also perform real-time calculations to enhance data collection and user interaction.

Whether you’re building a feedback survey, order form, or event registration, leveraging these tools will greatly improve the functionality of your forms.

Mapping logic and calculations with the Logic Map

A logic map is essential when combining logic and calculations in a form, providing a clear, visual representation of each step in the process.

logic map options

With it, you can see how each answer triggers specific calculations or conditional logic, helping you streamline and troubleshoot complex setups.

Why use the Logic Map for logic & calculations

  • Visualize calculations: With calculations, seeing each step in a map form helps ensure that formulas and calculations work as intended.

  • Clarify conditional paths: When combining logic and calculations, a logic map highlights how each condition or response triggers different actions, such as redirecting users or showing different results.

  • Troubleshoot with ease: By viewing the entire form flow, you can catch any missed conditions or calculation errors early, ensuring a smoother experience for users.

How to access and use the Logic Map

  1. Open the Logic tab: In the form editor, navigate to the Logic tab to set up and view your conditions.

  2. Select the Logic Map overview option: Click on the Logic Map to see a visual representation of each path, including how calculations are integrated with conditional jumps.

  3. Check for flow accuracy: Confirm that each conditional path and calculated variable leads to the correct outcome, ensuring a cohesive, user-friendly experience.

logic map

By using a logic map, you can effectively combine conditional logic with calculations, creating forms that adapt dynamically and perform real-time operations based on user input.

🗄️ Old dashboard:

In the dashboard,

  1. Click on the form you’d like to add logic to;

  2. Click on the Logic button located between the “Calculator” and “Duplicate” buttons.

You’ll see a flowchart showing the form’s fields as boxes and arrows connecting fields to indicate how your audience will navigate through fields when filling out the form.

  1. Select the boxes (fields) on the flowchart for which you want to add logic to

  2. In the sidebar, you can start adding rules by clicking on the “Add Logic” button or editing the default rule inputs already present in the box.

You can add multiple rules to a field by clicking the Add Rule button.

Basic logic example with Formaloo - old dashboard
Did this answer your question?