MENU
    Typecasting Expressions
    • 22 Sep 2023
    • 2 Minutes to read
    • Contributors

    Typecasting Expressions


    Article summary

    Learn how to change your data types using the Expression Editor.

    Typecasting is the method to convert data types into a different data type, in order to use the data in different methods or contexts. You can typecast data in Tulip using the Expression Editor in a Trigger.


    Converting Text

    texttoboolean()
    Parses text into a Boolean. “y”, “yes”, “t”, “true”, and “on” (and any capitalized variants) are recognized as true, and “n”, “no”, “f”, “false”, and “off” are recognized as false.

    texttoboolean expression

    In the example below, each text variable on the left converts to a boolean on the right side.

    texttoboolean expression in app

    texttodatetime()
    Changes a given text data type to a Datetime data type

    NOTE: For this expression, you are required to include a timezone in the expression. View this website for a list of supported timezones.

    texttodatetime expression ex

    texttodatetime expression ex in app

    texttofile()
    Converts text into a file

    texttofile expressions ex

    texttoimageurl()
    Converts text into an Image URL

    texttoimageurl expression ex

    texttofile and imageurl expression ex in app

    texttointeger()
    Parses text into an Integer

    texttointeger expression ex

    texttonumber()
    Parses text or a timestamp into a Number

    texttonumber expression ex

    Converting to Text

    datetimetotext()
    Changes a given datetime data type to a text data type

    datetimetotext expression ex

    datetimetotext expressions ex in app

    filetotext()
    Converts a file into text

    filetotext expressions ex

    filetotext expression ex in app

    totext()
    Parses anything into text

    Other Typecasting Expressions

    badge_id_to_user()
    Converts a badge ID to a User object

    badge_id_to_user expression ex

    badge_id_to_user expression ex in app

    int_to_hex()
    Returns the hexadecimal representation of the given number

    int_to_hex expression ex

    int_to_hex expression ex in app

    hex_to_int()
    Returns the numeric representation of the given hexadecimal string

    hex_to_int expression ex

    hex_to_int expression ex in app

    interval_to_seconds()
    Returns the length of an Interval in seconds

    int_to_hex expression ex

    int_to_hex expression ex in app

    interval_to_seconds()
    Returns the length of an interval in seconds

    seconds_to_interval expression ex

    seconds_to_interval()
    Converts seconds into an interval

    interval_to_seconds expression ex

    intervals and seconds expressions ex in app

    user_id_to_user()
    Converts a user ID to a user object

    user_id_to_user expression ex

    user_id_to_user expression ex in app


    Did you find what you were looking for?

    You can also head to community.tulip.co to post your question or see if others have faced a similar question!


    Was this article helpful?