Edit

Share via


Conversion functions in mapping data flows

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 in both Azure Data Factory pipelines and Azure Synapse Analytics pipelines. This article applies to mapping data flows. If you're new to transformations, refer to the introductory article Transform data using mapping data flows.

This article provides 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 the 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 specific charset. You can use a second (optional) argument to specify which charset to use: US-ASCII, ISO-8859-1, UTF-8 (default), UTF-16BE, UTF-16LE, or UTF-16.
encode Encodes the input string data into binary based on a charset. You can use a second (optional) argument to specify which charset to use: US-ASCII, ISO-8859-1, UTF-8 (default), UTF-16BE, UTF-16LE, or 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 by using an optional input date format. Refer to Java's SimpleDateFormat class for available formats. If the input date format is omitted, the 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 Checks 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 time stamp by using an optional input time-stamp format. Refer to Java's SimpleDateFormat class for available formats. If the time stamp is omitted, the default pattern yyyy-[M]M-[d]d hh:mm:ss[.f...] is used. You can pass an optional time zone in the form of GMT, PST, UTC, and America/Cayman. Timestamp supports up to millisecond accuracy with a value of 999. Refer to Java's SimpleDateFormat class for available formats.
toBase64 Encodes the specific string in base64.
toBinary Converts any numeric/date/time stamp/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. You can use an optional Java decimal format for the conversion.
toDate Converts an input date string to date by using an optional input date format. Refer to Java's SimpleDateFormat class for available formats. If the input date format is omitted, the 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 defaults to (10,2). You can use an optional Java decimal format for the conversion. Use an optional locale format in the form of a BCP47 language like en-US, de, or zh-CN.
toDouble Converts any numeric or string to a double value. You can use an optional Java decimal format for the conversion. Use an optional locale format in the form of a BCP47 language like en-US, de, or zh-CN.
toFloat Converts any numeric or string to a float value. You can use an optional Java decimal format for the conversion. Truncates any double.
toInteger Converts any numeric or string to an integer value. You can use an optional Java decimal format for the conversion. Truncates any long, float, double.
toLong Converts any numeric or string to a long value. You can use an optional Java decimal format for the conversion. Truncates any float, double.
toShort Converts any numeric or string to a short value. You can use an optional Java decimal format for the conversion. Truncates any integer, long, float, double.
toString Converts a primitive data type to a string. You can specify a format for numbers and date. If unspecified, the system default is picked. Java decimal format is used for numbers. Refer to Java's SimpleDateFormat class for all possible date formats. The default format is yyyy-MM-dd.
toTimestamp Converts a string to a time stamp given an optional time-stamp format. If the time stamp is omitted, the default pattern yyyy-[M]M-[d]d hh:mm:ss[.f...] is used. You can pass an optional time zone in the form of GMT, PST, UTC, and America/Cayman. Timestamp supports up to millisecond accuracy with a value of 999. Refer to Java's SimpleDateFormat class for available formats.
toUTC Converts the time stamp to UTC. You can pass an optional time zone in the form of GMT, PST, UTC, and America/Cayman. It default to the current time zone. Refer to Java's SimpleDateFormat class for available formats.