Workflow Conversion Functions
A conversion function converts one data type or format to another data type or format. For example, use a conversion function to convert numbers to strings or strings to numbers. Conversion functions can be used with String and Number data types.
CharFromInt
CharFromInt(x): Returns the Unicode® character that matches the input number x.
Note
This function isn't available for Live Query for Databricks.
Example
CharFromInt(66)returns B (U+0042 'Latin Capital Letter B').
CharFromInt(169)returns © (U+00A9 'copyright sign').
CharFromInt(1071)returns Я (U+042F 'Cyrillic capital letter YA').
CharFromInt(0)returns [null] (U+000 'Null') because any integer that cannot be used to represent a character may give a null result.
CharFromInt(55300)returns [null] because any integer that does not currently represent a character will not be rendered by a normal font.
ToDegrees
ToDegrees(x): Converts a numeric radian value (x) to degrees via the (x)rad × 180/π calculation. Please note that x must be a numeric value and can’t include any radian symbol (rad).
ToNumber
ToNumber(x, [bIgnoreErrors], [keepNulls], [decimalSeparator]): Converts a string (x), to a number. Brackets indicate optional parameters.
ToNumber accepts strings that can be interpreted as scientific notation double precision. By default, the period is used as the decimal separator.
Optional Parameters
bIgnoreErrors
(default) 0 or false reports conversion error messages.
1 or true ignores conversion errors.
keepNulls
(default) 0 or false converts non-numeric values (including null) to zero.
1 or true converts non-numeric values to null.
decimalSeparator: The decimal separator of the incoming string.
(default) "." specifies a period as the decimal separator.
"," specifies a comma as the decimal separator.
The decimalSeparatorparameter ignores whatever is the designated thousands separator (space, period, comma) of the incoming string.
Examples
ToNumber("878")returns the string 878 as a number.
ToNumber("4.256411411E9")returns the string 4256411411 as a number.
ToNumber("Number", "false")returns 0 with conversion error: TONUMBER: Number lost information in conversion.
ToNumber("Number", 0, 0)returns 0 with conversion error: TONUMBER: Number lost information in conversion.
ToNumber("Number", 1, 0)returns 0 with no conversion error.
ToNumber("Number", 1, 1)returns [Null] and no conversion error.
ToNumber("123456,789", 1, 1, ",")returns 123456.789 as a number.
ToNumber("123.456,789", 1, 1, ",")returns 123456.789 as a number. This is because the period is automatically interpreted as the thousands separator, while the comma is specified as the decimal separator via decimalSeparator.
ToRadians
ToRadians(x): Converts a numeric degree value (x) to radians via the (x)° × π/180 calculation. Please note that x must be a numeric value and can’t include the degree symbol (°).
ToString
ToString(x, numDec, [addThousandsSeparator], [decimalSeparator]): Converts a numeric parameter (x) to a string that uses numDec decimal places. Default selection uses a period as the decimal separator. Brackets indicate optional parameters.
Optional Parameters
addThousandsSeparator
(default) 0 formats the numeric string without a thousands separator.
1 formats with a thousands separator. By default, the thousands separator is a comma unless "," is specified for
decimalSeparator, in which case the thousands separator is a period."," specifies a comma as the thousands separator.
"." specifies a period as the thousands separator.
" " specifies a space as the thousands separator.
"'" specifies an apostrophe as the thousands separator.
decimalSeparator:
(default) "." specifies the period as the decimal separator.
"," specifies the comma as the decimal separator.
Examples
ToString(10, 0) returns 10 as a string.
ToString(10.4, 2) returns 10.40 as a string.
ToString(100.4, 2) returns 100.40 as a string.
ToString(1000.4, 2, 1) returns 1,000.40 as a string.
ToString(123456.789, 3, 1, ",") returns 123.456,789 as a string.
ToString(123456.789, 3, 0, ",") returns 123456,789 as a string.
ToString(1234567.89, 2, ".", ",") returns 1.234.567,89 as a string.
ToString(1234567.89, 2, " ", ",") returns 1 234 567,89 as a string.
ToString(1234567.89, 2, "'", ",") returns 1'234'567,89 as a string.