LogoLogo
Back to studio
  • Formsort documentation
  • โฉQuickstart
    • ๐ŸŸขGet started with Formsort
    • ๐ŸŽCore concepts
    • โ„น๏ธQuestion and content reference
    • ๐Ÿ“•Key terms
    • ๐Ÿž๏ธCreate your first flow
    • ๐Ÿ“–Add content and collect answers
      • ๐ŸคณCapture demographic data
      • โ„น๏ธAdd informational content
      • ๐Ÿ” Review your variable schema
    • ๐ŸŽจCreate a theme
      • Set brand guidelines
    • ๐ŸคนPersonalize your flow
      • ๐ŸŒŸTemplate your variables
      • ๐Ÿง Add conditional logic
      • ๐Ÿ’ซUsing conditional logic with Calculated and API variables
      • ๐Ÿ”šEnd the flow
    • ๐Ÿ”€Set up integrations
    • ๐Ÿš€Go live
      • Auditing your flow for content, functionality, and design
    • ๐Ÿ’ผCommon use cases
      • ๐Ÿ’”Disqualify responders
      • ๐Ÿ—“๏ธAdd a scheduling option
      • ๐Ÿ“„Allow responders to read and accept your company policies
  • ๐Ÿ—๏ธBuilding flows
    • Flows and variants
      • Flow starts
    • Adding content
      • Groups
      • Steps
        • Settings
        • Logic
        • Style
      • Questions
        • General Settings
        • Style
        • Address
        • Comparison
        • Confirmation
        • Date
        • Date & Time
        • Email address
        • File upload
        • Grid choice
        • Iframe
        • Image upload
        • Number
        • Payment
        • Phone number
        • Postal code
        • Question group
        • Region
        • Select
          • Providing choices via API or calculation
        • Signature
        • SSN
        • Text questions
        • Yes/No
      • Content
        • General Settings
        • Statement
        • Image
        • Video
        • Next button
        • Divider
        • Map
      • Endings
      • Using markdown
      • Using variable templating
        • Template formatting functions
      • Copy-pasting form content
      • Content library
    • Conditions and logic
      • Logical operator reference
      • Advanced logic
    • Variables (answers)
      • Variables from questions
      • Externally provided variables
      • Calculated variables
      • API lookups
      • System Library variables
      • Orphaned variables
    • Schemas
      • JSON Schemas
      • Validating flow schemas
    • Redirects
    • Styling and themes
      • CSS Reference
      • Overriding theme styling
      • Custom CSS overrides
      • Content area
      • Animations and transitions
      • Form Layout
      • Typography
        • Adobe Fonts
        • Hosting custom fonts
      • Color variables
      • Dimension variables
      • Question containers
      • Assets
      • Form Buttons
        • Select buttons
      • Inputs and dropdowns
      • Checkmarks
      • Tables
      • Sliders
      • Divider lines
      • Progress bar
      • Comparison cards
    • Variant settings
      • Form behavior for returning responders
      • Group ranking API
    • Publishing and versions
      • Preview window
      • Deploying
      • History
  • ๐Ÿ’พHandling data
    • Philosophy and data retention policy
    • Viewing form answers
    • Responder UUIDs
    • Environments
      • Loading different environments
    • Passing data in
      • URL parameters
      • POST body
      • Embed query parameters
    • Custom validators
    • Form answers and events
      • Analytics events
      • Signed requests
      • Event payload shape
      • Submission frequencies
      • Runtime error reporting
      • Admin API
      • Flow content data format
    • Integration reference
      • Amplitude
        • Amplitude cross domain tracking
      • BigQuery
      • FullStory
      • Google Analytics
        • Updating from Universal Analytics to GA4
      • Google Cloud Storage
      • Google Sheets
      • Google Tag Manager (GTM)
        • JavaScript triggered by flow events
      • Hubspot
      • Jornaya
      • Optimizely
      • PostgreSQL
      • Redshift
      • Rudderstack
      • S3
      • Salesforce
      • Segment
        • Segment Setup
        • Segment cross domain tracking
      • Stripe
      • TrustedForm
      • Webhooks
        • Zapier
  • ๐Ÿ“บGoing live
    • Custom domains
    • Built-in analytics
    • Embedding
      • Web-Embed API
        • React-embed
      • Adding authentication
      • Embedding forms in iOS and Android
      • Setting up a dev environment
    • Split testing
    • Preflight checklist
  • ๐ŸขTeams
    • Accounts
      • Roles and permissions
    • Events subscriptions
    • Workspace domain detection
Powered by GitBook
On this page
  • Content order and conditional logic
  • Simple logic editor
  • Multi-Clause Conditions
  • Advanced logic
  • Optional?

Was this helpful?

  1. Building flows

Conditions and logic

Modify your flow's behavior using answers collected.

PreviousContent libraryNextLogical operator reference

Last updated 7 months ago

Was this helpful?

Conditional logic is useful for making flows dynamic and more personalized; rather than creating multiple flows for different scenarios, flow questions, steps, and groups can be rendered dynamically based on the answers the responder has provided.

Conditional logic can be used to control the enablement of many items in the flow, such as:

  • , , or


Content order and conditional logic

When setting up the form logic for questions, groups, and steps, it is important to understand that the user experiences the flow according to the order you establish in the Content Editor, from Step 0 to the final step. When logic is applied to any group/step/question element, this order can be manipulated since the logic will either render or hide that item.

Applying logic involves adding logical arguments that evaluate to either True or False. If the statement is True, the element is enabled. If the statement is False, the element will be removed.

Using logic will not "pull" users to particular steps -- they will not go from Step 1 to Step 30 by adding logic to Step 30.

Conditional logic merely hides or renders elements as the user moves from Step 1 -> finalize.

View this flow setup:

A question is posed at Step 1: Do you have a cat or a dog?

  • If the user answers cat: the logic at Step 2 is True, and Step 2 is shown; Step 3 is false and will be hidden. Once Step 2 is completed, the user does not see Step 3.

  • If the user answers dog: the logic at Step 2 is false, and Step 2 is hidden; the user moves on to Step 3, which has evaluated to True.

This is a simple but common example, and illustrates well how the user experience is manipulated based on the step logic evaluating to True or False.

Simple logic editor

At it's most basic, the simple logic editor can accept one argument to determine whether or not to enable a specific item.

A logical argument is built using three parts:

  • The variable (answers, external variables, etc);

  • The expected value of the variable.

The studio will only accept logic that is dependent on variables that will have been previously defined in the form. This means you cannot add logic to Step 1 based on an answer that will become defined at Step 3.

Multi-Clause Conditions

If the conditional rendering of your step depends on more than one condition being satisfied, the simple logic editor can accept several arguments using the +Add condition button in the simple logic menu.

You can also nest the logic of conditions by grouping (+Add group) the logic.

Advanced logic

If the logic you are trying to express involves a combination of multiple different answers, you can use advanced logic to define arbitrary boolean expressions over the answers.


Optional?

The logical operator (see our documentation for reference);

In the picture above, we are using an value to determine whether or not to render the first step: If our external variable value equals "facebook", the step is rendered.

If you find that you are adding many multi-clause conditions, you might be beyond the scope of simple logic and should check out our instead.

To learn more about advanced logic, see our sub-section.

For even more complicated conditional logic, define a boolean(True/False) , which allows you to use arbitrary Typescript to create conditional a True/False return, which can then be used in a simple logic check.

Toggling on Optional? for a allows users to move past a question without answering it. The default behavior for Formsort flows is to let users progress only when all questions have been satisfied; optional can override this.

๐Ÿ—๏ธ
logical operator
external variable
calculated variables
advanced logic
calculated variable
Question
Questions
Steps
Groups
Redirects
Calculated variables
API variables
Using the simple logic editor to conditionally render the first step
Creating a two-argument AND statement in the logic editor