Skip to main content

To Boolean

Converts a string to a boolean value (true/false).

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • String - String to convert to boolean. Accepts: "true", "false", "1", "0", "t", "f", "T", "F", "TRUE", "FALSE".

Options

This node does not have configurable options.

Output

  • Result - The converted boolean value (true or false).

How It Works

The To Boolean node converts string representations to boolean values using standard parsing rules:

Accepted values for true:

  • "true", "True", "TRUE", "t", "T"
  • "1"

Accepted values for false:

  • "false", "False", "FALSE", "f", "F"
  • "0"

The conversion is case-insensitive and follows Go's strconv.ParseBool behavior.

Usage Examples

Example 1: Convert User Input

Convert form checkbox value to boolean:

  • String: "true"
  • Result: true

Example 2: Convert Numeric Boolean

Convert numeric boolean flag:

  • String: "1"

  • Result: true

  • String: "0"

  • Result: false

Example 3: API Response Processing

Convert API boolean field from string:

  • String: "False"
  • Result: false

Error Handling

The node will return an error in the following cases:

Empty String:

String: ""
Error: "Text cannot be empty"

Invalid Value:

String: "yes"
Error: "String value should be 'true' or 'false', but got: yes"

Tips

  • Input is case-insensitive: "TRUE", "True", and "true" all work
  • Use for parsing configuration files, API responses, or user inputs
  • Combine with conditional nodes to create boolean-based logic
  • Common in form processing where checkboxes return "true"/"false" strings
  • Alternative representations: "1" for true, "0" for false

Common Errors and Solutions

Error: "Text cannot be empty"

  • Cause: Empty string provided
  • Solution: Ensure the input string has a value, or handle empty strings before conversion

Error: "String value should be 'true' or 'false', but got: X"

  • Cause: Invalid string value that cannot be converted to boolean
  • Solution: Validate input strings. Only use: true, false, 1, 0, t, f (case-insensitive)

Practical RPA Examples

Example: Process Configuration File

Input String: "TRUE"
Output: true
Use Case: Enable/disable features based on config file

Example: Database Flag Conversion

Input String: "1"
Output: true
Use Case: Convert database boolean flags stored as strings

Example: Form Data Processing

Input String: ${msg.checkboxValue}  // "true" or "false"
Output: true/false
Use Case: Process web form submissions

Example: API Response Handling

Input String: ${msg.response.isActive}  // "False"
Output: false
Use Case: Convert string boolean from JSON responses
  • ToNumber - Convert string to number
  • ToString - Convert any value to string
  • Compare - Compare strings for equality