Cast to boolen

Cast to Boolean

Description

Converts a value to the boolean type.

Category

Transformation

Supported Field Types

  • text
  • float
  • int

Output Field Type

  • boolean

Arguments

None

Pseudo-code (Python)

def func(val):
    """
        val: original value
    """
    if val:
        if type(val) is text: 
            return val.lower() == "true"
        else:
            return bool(val)
    else:
        return None

Cast values to boolean in Kondado

Use the Cast to Boolean transformation to convert text, float, or integer fields into boolean values in your Kondado pipelines.

1
Identify fields to convert

Review your source schema and identify text, float, or integer fields that should be represented as boolean (for example, 'true'/'false' strings or 1/0 integers) before loading into your destination.

2
Open the pipeline transformations

Open the pipeline that loads the source field and navigate to the transformations step where you can add functions to individual fields.

3
Apply the Cast to Boolean function

Add the Cast to Boolean function to the chosen field. No arguments are required: text values matching 'true' (case-insensitive) become true, numeric values are converted with standard boolean rules, and null/empty inputs return None.

4
Validate the output type

Run a test execution and confirm the field now returns boolean values. Pay attention to edge cases such as empty strings or zero values to make sure the conversion matches your business logic.

5
Replicate to your destination

Save the pipeline and let Kondado replicate the cleaned boolean field into your data warehouse, BI tool, or spreadsheet at the frequency you choose.

Frequently asked questions

What input types does the Cast to Boolean function support?
The Cast to Boolean function supports three input field types: text, float, and int. For text values, it checks if the lowercase string equals 'true'; for numeric values, it applies standard Python bool() conversion; and for null/empty inputs, it returns None.
How does the function handle text values like 'True' or 'FALSE'?
The function performs case-insensitive comparison on text values. Any case variation of 'true' (such as 'True', 'TRUE', or 'true') will convert to boolean true. All other non-empty text strings convert to false.
What happens when the input value is null or empty?
When the input value is null, empty, or otherwise falsy, the function returns None rather than boolean false. This preserves the distinction between missing data and explicitly false values in your data transformation pipeline.
Can I use Cast to Boolean when importing data to spreadsheets?
Yes, after applying the Cast to Boolean transformation in your pipeline, you can send the cleaned boolean data to any supported destination. This includes spreadsheets, where proper boolean formatting improves readability and filtering.
Does this function require any configuration arguments?
No, the Cast to Boolean function takes no arguments. Simply select the field you want to convert, and the function automatically applies the appropriate conversion logic based on the input field's type and value.

Written by·Published 2024-12-20·Updated 2026-04-26