/
How to check for empty string in Flow studio

How to check for empty string in Flow studio

This document explains how to check for an empty string in the Flow studio using Evaluate Control.

In the below example, we will pass an empty string to the Evaluate control using Custom control. Then we will use the Regex code in the Evaluate control to verify the empty string.

Custom control

  1. Use a Custom control in the Flow studio flow to build your custom logic.

  2. In the Experience Designer, place the below code in the Function node to set an empty string.

    msg.orbita.session.emptyString = ""; return msg;

Evaluate control

You have to use the Evaluate control to check for an empty string in the Flow studio.

  1. Drop the Evaluate control onto the canvas.

  2. Select Custom from the Input node list. (You will have access to the entire msg object when you use Custom from the list.)

  3. In the input field, add the empty string property path (as a mustache tag).
    In this example, it is at msg.orbita.session.emptyString

  4. In the pin options, select “matches regex“ from the list and add the below Regex to evaluate.

    ^\s$

The regex ^\s$ will match an empty string or a single space.
If you want to match an empty string or multiple spaces, use ^\s*$

Related articles

Related content

How do I use Free Text input in Flow Studio?
How do I use Free Text input in Flow Studio?
More like this
How to retrieve partial conversation using flow studio
How to retrieve partial conversation using flow studio
Read with this
How to remove comma in the chatbot when using options(multi select) control in the Flow Studio
How to remove comma in the chatbot when using options(multi select) control in the Flow Studio
More like this
How to enable go back feature in Flow Studio
How to enable go back feature in Flow Studio
Read with this
3.3.9.2 Custom Control
3.3.9.2 Custom Control
More like this
Guide to Flow Studio
Guide to Flow Studio
Read with this