Table of Contents

Get started with the Formulas block

Note: The Formulas block is only available on the Professional and Business plans.

Prefer watching than reading? No problem, we've got you covered πŸ‘‡

What are Formulas?

The Formula block lets you make complex operations inside Landbot in a simple and straight-forward way, no coding skills required! You may already be familiar with how formulas work if you already use Microsoft Excel or Google Sheets. By setting up a Formula, Landbot will do all the hard work for you, whether it's a mathematical operation to calculate the score for your lead gen bot, figure out when your store is open or closed, or just take your chatbot flow to the next level without having to rely on a developer.

Whereas before you could only transform data with Javascript or with external API's, now you will be able to easily do it by using Formulas.

How to create a Formula

In your chatbot, select the Formula block. You will find in the Simple menu by clicking on Flow Operations, or open the Advanced menu and type Formula in the search bar.

1. Select the variable where you want to store the outcome of the formula

2. Choose the output that fit your needs

3. Set the formula

4. Save and use

Elements of the Formulas block

1. Output

In the Output field you can define or create the variable where the result of the formula is going to be stored.

For the Block outputs you can choose the type of output that fit your needs. You have:

  • Success/Error: For mathematical operations
  • True/False: For types of formulas in which the outcome is a boolean value
  • Custom: When you want specific results as custom outputs

2. Formula

This is the editor, where you can create and edit formulas

Right under the formula you can check the result in real time, plus test other values in the formula.

3. Formulas Browser/Docs

In this section, you will see all the available methods you can use in the Formulas block.

Things you can do when building your formulas

1. Formulas can use fixed values

2. Formulas can use Landbot variables

3. Formulas can use formulas inside formulas

4. Formulas can use same output variable

5. Formulas can be chained one after another

6. Formulas work great with the Conditional block

Things to be aware of when building your formulas

1. Blue ticks!

For a formula to be valid, make sure both ticks are blue

2. Output variable type

Make sure the type of the variable is in the right format, relevant to the type of formula you are using.

For example, if you are creating a math operation, you want the variable of the output to be a number, not a string type.

3. True and False are strings that start with A Capital Letter!

In case you are using a type of formula where the outcome can be a boolean value, remember that True or False are strings where the first letter is Uppercase.

4. System variables need " "

If you are planning to use Landbot System variables like @today, add the " " between those variables:

5. Variables that haven't been created yet need " "

If the variable has not been created yet, it needs to be wrapped in " " to be a valid formula

6. Test before you go into production!

Make sure you always test your bot to ensure the Formulas work as expected.

Types of Formulas

Comparison

Comparison formulas available:

  • IsEqual
  • IsNotEqual
  • IsGreater
  • IsGreaterOrEqual
  • IsLess
  • IsLessOrEqual
  • IsSet

You can check examples of use case of Comparison formulas in this article.

Logical

Logical formulas available:

  • And
  • If
  • Not
  • Or

You can check examples of use case of Logical formulas in this article.

Math

Math formulas available:

  • Product
  • Quotient
  • Remainder
  • Subtract
  • Sum
  • ToFloat
  • ToInteger

You can check examples of use case of Math formulas in this article.

String

String formulas available:

  • Capitalize
  • Contains
  • Length
  • Lower
  • Replace
  • Slice
  • Split
  • Title
  • ToString
  • Upper

You can check examples of use case of String formulas in this article.

Array

Array formulas available:

  • Contains
  • GetValue
  • IndexOf
  • Length
  • List
  • Slice
  • Push

You can check examples of use case of Array formulas in this article.

Object

Object formulas available:

  • GetValue
  • ToJSON

You can check examples of use case of Object formulas in this article.

Regex

Regex formulas available:

  • RegexTest

You can check examples of use case of Regex formulas inΒ this article.

How did we do?

How to Perform Basic Calculations

Formulas Blocks Dashboard

Contact