Conversion functions in mapping data flow

APPLIES TO: Azure Data Factory Azure Synapse Analytics

Tip

Try out Data Factory in Microsoft Fabric, an all-in-one analytics solution for enterprises. Microsoft Fabric covers everything from data movement to data science, real-time analytics, business intelligence, and reporting. Learn how to start a new trial for free!

Data flows are available both in Azure Data Factory and Azure Synapse Pipelines. This article applies to mapping data flows. If you are new to transformations, please refer to the introductory article Transform data using a mapping data flow.

The following articles provide details about expressions and functions supported by Azure Data Factory and Azure Synapse Analytics in mapping data flows.

Conversion function list

Conversion functions are used to convert data and test for data types

Conversion function Task
ascii Returns the numeric value of the input character. If the input string has more than one character, the numeric value of the first character is returned
char Returns the ascii character represented by the input number. If number is greater than 256, the result is equivalent to char(number % 256)
decode Decodes the encoded input data into a string based on the given charset. A second (optional) argument can be used to specify which charset to use - 'US-ASCII', 'ISO-8859-1', 'UTF-8' (default), 'UTF-16BE', 'UTF-16LE', 'UTF-16'
encode Encodes the input string data into binary based on a charset. A second (optional) argument can be used to specify which charset to use - 'US-ASCII', 'ISO-8859-1', 'UTF-8' (default), 'UTF-16BE', 'UTF-16LE', 'UTF-16'
isBitSet Checks if a bit position is set in this bitset
setBitSet Sets bit positions in this bitset
isBoolean Checks if the string value is a boolean value according to the rules of toBoolean()
isByte Checks if the string value is a byte value given an optional format according to the rules of toByte()
isDate Checks if the input date string is a date using an optional input date format. Refer to Java's SimpleDateFormat for available formats. If the input date format is omitted, default format is yyyy-[M]M-[d]d. Accepted formats are [ yyyy, yyyy-[M]M, yyyy-[M]M-[d]d, yyyy-[M]M-[d]dT* ]
isShort Checks if the string value is a short value given an optional format according to the rules of toShort()
isInteger Checks if the string value is an integer value given an optional format according to the rules of toInteger()
isLong Checks if the string value is a long value given an optional format according to the rules of toLong()
isNan Check if a value isn't a number.
isFloat Checks if the string value is a float value given an optional format according to the rules of toFloat()
isDouble Checks if the string value is a double value given an optional format according to the rules of toDouble()
isDecimal Checks if the string value is a decimal value given an optional format according to the rules of toDecimal()
isTimestamp Checks if the input date string is a timestamp using an optional input timestamp format. Refer to Java's SimpleDateFormat for available formats. If the timestamp is omitted, the default pattern yyyy-[M]M-[d]d hh:mm:ss[.f...] is used. You can pass an optional timezone in the form of 'GMT', 'PST', 'UTC', 'America/Cayman'. Timestamp supports up to millisecond accuracy with value of 999 Refer to Java's SimpleDateFormat for available formats.
toBase64 Encodes the given string in base64.
toBinary Converts any numeric/date/timestamp/string to binary representation.
toBoolean Converts a value of ('t', 'true', 'y', 'yes', '1') to true and ('f', 'false', 'n', 'no', '0') to false and NULL for any other value.
toByte Converts any numeric or string to a byte value. An optional Java decimal format can be used for the conversion.
toDate Converts input date string to date using an optional input date format. Refer to Java's SimpleDateFormat class for available formats. If the input date format is omitted, default format is yyyy-[M]M-[d]d. Accepted formats are :[ yyyy, yyyy-[M]M, yyyy-[M]M-[d]d, yyyy-[M]M-[d]dT* ].
toDecimal Converts any numeric or string to a decimal value. If precision and scale aren't specified, it's defaulted to (10,2). An optional Java decimal format can be used for the conversion. An optional locale format in the form of BCP47 language like en-US, de, zh-CN.
toDouble Converts any numeric or string to a double value. An optional Java decimal format can be used for the conversion. An optional locale format in the form of BCP47 language like en-US, de, zh-CN.
toFloat Converts any numeric or string to a float value. An optional Java decimal format can be used for the conversion. Truncates any double.
toInteger Converts any numeric or string to an integer value. An optional Java decimal format can be used for the conversion. Truncates any long, float, double.
toLong Converts any numeric or string to a long value. An optional Java decimal format can be used for the conversion. Truncates any float, double.
toShort Converts any numeric or string to a short value. An optional Java decimal format can be used for the conversion. Truncates any integer, long, float, double.
toString Converts a primitive datatype to a string. For numbers and date, a format can be specified. If unspecified the system default is picked.Java decimal format is used for numbers. Refer to Java SimpleDateFormat for all possible date formats; the default format is yyyy-MM-dd.
toTimestamp Converts a string to a timestamp given an optional timestamp format. If the timestamp is omitted the default pattern yyyy-[M]M-[d]d hh:mm:ss[.f...] is used. You can pass an optional timezone in the form of 'GMT', 'PST', 'UTC', 'America/Cayman'. Timestamp supports up to millisecond accuracy with value of 999. Refer to Java's SimpleDateFormat class for available formats. https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html.
toUTC Converts the timestamp to UTC. You can pass an optional timezone in the form of 'GMT', 'PST', 'UTC', 'America/Cayman'. It's defaulted to the current timezone. Refer to Java's SimpleDateFormat class for available formats. https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html.