User Tools

Site Tools


transformations:convert

Convert Data Types

This transformation converts values of one type (e.g. text) to another type (e.g. number). There are 3 modes:

Text to date

In this mode text values that look like a date are converted into number dates. A date format must be specified. All text values that match the specified format are converted to number dates. For instance:

Format: M/d/yyyy

Before (text) After Comment
12/31/2017 43100 Corresponds to December 31st, 2017.
12-31-2017 12-31-2017 No conversion happened as the text value didn't match the specified format.

The format notation is the same as for the format() function.

Text to number

In this mode text values that look like a number are converted into numbers. For instance:

Decimal separator: Point

Before (text) After Comment
1000 1000
1,000 1,000 No conversion happened as the text value has different decimal separator.
10.00 10
$1000 $1000 No conversion happened as the text value is not recognized as a number.

Everything to text

In this mode text values remain unchanged and non-text values are converted into text. Numbers are formatted as per the specified format. For instance:

Number format: 100%

Before After (text) Comment
10 1000%
$1000 $1000 No conversion happened as the value is not a number.
ABcd ABcd No conversion happened as the value is not a number.
TRUE TRUE Booleans are converted to text.
#Error Error Errors can be converted into text too.
43100 4310000% This value is probably a date (#2017-12-31) but since the specified number format is percentage the value was converted into percentage formatted text. A date format should've been used.

See also

transformations/convert.txt · Last modified: 2018/01/23 05:05 by dmitry