Skip to main content
Workday User Guide
Last Updated: 2023-06-23
TO_STRING

TO_STRING

Description

TO_STRING
is a row function that converts values of other data types to
TEXT
(character) values.

Syntax

TO_STRING
(
expression
)
TO_STRING
(
date_expression
,
date_format
)

Return Value

Returns one value per row of type
TEXT
.

Input Parameters

expression
A field or expression of type
TEXT
,
BOOLEAN
,
INTEGER
,
LONG
,
NUMERIC
,
DOUBLE
,
INSTANCE
, or
MULTI-INSTANCE
. When you convert an Instance or Multi-Instance field to a string, this function returns the unique identifier (WID), not the display name, of the field value. When a Multi-Instance field contains more than 1 value, this function concatenates each value into a single string with no spaces.
date_expression
A field or expression of type
DATE
.
date_format
If converting a
DATE
to
DATE
, a pattern that describes how the date is formatted. See TO_DATE for the date format patterns.

Examples

Convert the values of the
sku_number
field to a Text field type:
TO_STRING([sku_number])
Convert values in the
age
column into range-based groupings (binning), and cast output values to a
TEXT
:
TO_STRING(CASE WHEN [age] <= 25 THEN "0-25" WHEN [age] <= 50 THEN "26-50" ELSE "over 50" END)
Convert the values of a
timestamp
Date field to
TEXT
, where the timestamp values are in the format of:
2002.07.10 at 15:08:56 PDT
:
TO_STRING([timestamp],"yyyy.MM.dd 'at' HH:mm:ss z")