Check if the Field is Boolean

Last updated on Jun 30, 2023
Definition: isBoolean(fieldname: str) → bool
Description: Checks if a specific field contains a boolean data type value. The return value can be further used to transform the data. For example, setting the account exists field to Yes.
Parameters: fieldname: The name of the field whose value is to be checked.
Returns: True, if the specified field’s value is of type, boolean.
False, for null and non-boolean values.

The following script checks if the specified property is a boolean:

from io.hevo.api import Event

def transform(event):
    <existing_properties> = event.getProperties()

    <boolean_value_type> = event.isBoolean('<property_name>')

    return event

Sample Transformation

The following script checks if the property named available is a boolean. The isBoolean property displays the return value of the method:

from io.hevo.api import Event

def transform(event):
    properties = event.getProperties()

    # Check if the 'available' field is Boolean
    if event.isBoolean('available'):
        properties['isBoolean'] = 'Yes'

    return event

Sample Output

The Transformation sets the isBoolean property to Yes, as the available property is boolean.

Is a Boolean



Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Feb-14-2023 NA New document.

Tell us what went wrong