Skip to content

TEXT_VIEW

The TEXT_VIEW node creates a text visualization for a given String DataContainer type. Inputs ------ default : String | Boolean The DataContainer to be visualized in text format Params: prettify : Boolean Whether to prettify the displayed text (defaults to True) Returns: out : String The DataContainer containing text data
Python Code
import pprint
from flojoy import flojoy, String, Boolean


@flojoy
def TEXT_VIEW(default: String | Boolean, prettify: bool = False) -> String:
    """The TEXT_VIEW node creates a text visualization for a given String DataContainer type.

    Inputs
    ------
    default : String | Boolean
        The DataContainer to be visualized in text format

    Parameters
    ----------
    prettify : Boolean
        Whether to prettify the displayed text (defaults to True)

    Returns
    -------
    String
        The DataContainer containing text data
    """

    match default:
        case String():
            s = default.s

            if prettify:
                s = pprint.pformat(default.s)

            return String(s)
        case Boolean():
            if default.b:
                return String("True")

            return String("False")

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

This example shows the function of the TEXT_VIEW node. It displays String data such as from the TEXT node.