Table of Contents

Formulas block (beta)

Dilyara Updated by Dilyara

Note: The Formulas block is only available on the Professional plan (and for a few extra months for Starter plan that helped us test this feature during the beta period.)

What are Formulas?

Formula block allows you to make complex operations with values inside Landbot, like you do in other platforms like Google Spreadsheets or Excel, and store the result in an outcome variable.

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

How to create a Formula

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 formula in which the outcome is a boolean value

  • Custom: When you want specific results as custom outputs

2. Formula

Here 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 can be great with the Conditional block

Things to be aware of when building your formulas

1. Blue ticks!

To be a valid formula, make sure both ticks are blue

2. Output variable type

Make sure the type of the variable is the right format 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 Capital letter!

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

4. System variables need " "

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

5. Not created variables need " "

If the variable is not created yet, it needs " " also to be a valid formula

6. Test before you go into production!

Test always to make sure the Formula works 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?

Keyword Options 🔑 Assign keywords to buttons (WhatsApp and Facebook)

Contact