Transformation Function Reference

As you map header and payload values between your source and target systems, you might want to modify the source header or payload data so that it conforms to your target format. You can do this using transformation functions.

The following transformation functions are available for Micro-Integration:

Function Name Parameters Returns Description

absoluteNumber

input (Number)—A number.

The absolute value of the input.

Returns the absolute (positive) value of a number. If the number is positive zero or negative zero, the result is positive zero. If the number is infinite, the result is positive infinity. If the number is NaN (Not a Number), the result is NaN.

calculateAverageFromNumberArray

input (Number[])—A numeric array.

The average of all elements as a double.

Calculates the average of all elements in the input array. The result is returned as an IEEE 754 double-precision (64-bit) floating-point value. All elements must be numeric. Returns 0 for an empty array. If any element is not a number, this function produces an error.

calculateSumFromNumberArray

input (Number[])—A numeric array.

The sum of all elements as a double.

Calculates the sum of all elements in the input array. The result is returned as an IEEE 754 double-precision (64-bit) floating-point value. All elements must be numeric. If any element is not a number or if the result exceeds the range of a double, this function produces an error.

ceilingNumberToDouble

input (Number)—A number to round up.

The ceiling of the input number.

Rounds up a number to the nearest whole value. The result is always a whole number, but is represented in a floating-point format. For example, the ceiling of 4.3 is 5.0 and the ceiling of -4.3 is -4.0. If the input is NaN (Not a Number), infinite, positive zero, or negative zero, then the returned value is the same as the input. If the input value is less than zero but greater than -1.0, then the result is negative zero.

concatString

inputs (String[])—An array of strings to be concatenated.

The concatenated string.

Concatenates an array of strings. If an element of the array is null, then the string "null" is added to the result.

convertAnyToJsonString

input (Object)—Object to be converted to JSON string.

The converted JSON string.

Serializes the given object into a JSON-formatted string.

convertBooleanToString

input (boolean)—A boolean to be converted to a string.

The string representing the input boolean value.

Converts a boolean value to a string. Returns "true" if the input value is true, and "false" if the input value is false.

convertEpochMicrosToIso8601UtcString

input (Number)—The number of microseconds since the epoch (1970-01-01T00:00:00Z).

An ISO 8601 formatted UTC timestamp string with second precision.

Converts epoch microseconds to an ISO 8601 formatted UTC timestamp string with second precision. Output always ends with Z. Format: yyyy-MM-dd'T'HH:mm:ss'Z'.

convertEpochMicrosToStringByPattern

input (Number)—The number of microseconds since the epoch (1970-01-01T00:00:00Z).

offset (String)—A valid UTC offset (e.g., "Z", "+05:30", "-04:00").

pattern (String)—A DateTimeFormatter pattern (e.g., "yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX").

locale (String)—An IETF BCP 47 language tag (e.g. "en-US") to use when producing locale-specific text.

The formatted date-time string.

Converts epoch microseconds to a string using a caller-defined pattern, UTC offset and an IETF BCP 47 language tag (e.g. "en-US") for locale. Use when the shortcut methods do not cover the required output format. Pattern examples: "yyyy-MM-dd" for date only, "yyyy-MM-dd'T'HH:mm:ssXXX" for second precision with offset, "yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX" for microsecond precision with offset.

convertEpochMillisToIso8601UtcString

input (Number)—The number of milliseconds since the epoch (1970-01-01T00:00:00Z).

An ISO 8601 formatted UTC timestamp string with second precision.

Converts epoch milliseconds to an ISO 8601 formatted UTC timestamp string with second precision. Output always ends with Z. Format: yyyy-MM-dd'T'HH:mm:ss'Z'.

convertEpochMillisToStringByPattern

input (Number)—The number of milliseconds since the epoch (1970-01-01T00:00:00Z).

offset (String)—A valid UTC offset (e.g., "Z", "+05:30", "-04:00").

pattern (String)—A DateTimeFormatter pattern (e.g., "yyyy-MM-dd'T'HH:mm:ss.SSSXXX").

locale (String)—An IETF BCP 47 language tag (e.g. "en-US") to use when producing locale-specific text.

The formatted date-time string.

Converts epoch milliseconds to a string using a caller-defined pattern, UTC offset and an IETF BCP 47 language tag (e.g. "en-US") for locale. Use when the shortcut methods do not cover the required output format. Pattern examples: "yyyy-MM-dd" for date only, "yyyy-MM-dd'T'HH:mm:ssXXX" for second precision with offset, "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" for millisecond precision with offset.

convertEpochSecondsToIso8601UtcString

input (Number)—The number of seconds since the epoch (1970-01-01T00:00:00Z).

An ISO 8601 formatted UTC timestamp string with second precision.

Converts epoch seconds to an ISO 8601 formatted UTC timestamp string with second precision. Output always ends with Z. Format: yyyy-MM-dd'T'HH:mm:ss'Z'.

convertEpochSecondsToStringByPattern

input (Number)—The number of seconds since the epoch (1970-01-01T00:00:00Z).

offset (String)—A valid UTC offset (e.g., "Z", "+05:30", "-04:00").

pattern (String)—A DateTimeFormatter pattern (e.g., "yyyy-MM-dd'T'HH:mm:ssXXX").

locale (String)—An IETF BCP 47 language tag (e.g. "en-US") to use when producing locale-specific text.

The formatted date-time string.

Converts epoch seconds to a string using a caller-defined pattern, UTC offset and an IETF BCP 47 language tag (e.g. "en-US") for locale. Use when the shortcut methods do not cover the required output format. Pattern examples: "yyyy-MM-dd" for date only, "yyyy-MM-dd'T'HH:mm:ssXXX" for second precision with offset.

convertIso8601StringToEpochMicros

input (String)—An ISO 8601 formatted timestamp string.

The number of microseconds since the epoch (1970-01-01T00:00:00Z).

Converts an ISO 8601 formatted timestamp string to epoch microseconds (microseconds since 1970-01-01T00:00:00Z). Accepts UTC (Z), offset (+05:30) timestamps.

convertIso8601StringToEpochMillis

input (String)—An ISO 8601 formatted timestamp string.

The number of milliseconds since the epoch (1970-01-01T00:00:00Z).

Converts an ISO 8601 formatted timestamp string to epoch milliseconds (milliseconds since 1970-01-01T00:00:00Z). Accepts UTC (Z), offset (+05:30) timestamps.

convertIso8601StringToEpochSeconds

input (String)—An ISO 8601 formatted timestamp string.

The number of seconds since the epoch (1970-01-01T00:00:00Z).

Converts an ISO 8601 formatted timestamp string to epoch seconds (seconds since 1970-01-01T00:00:00Z). Accepts UTC (Z), offset (+05:30) timestamps.

convertNumberToString

input (Number)—A number to be converted to string.

The string representation of the input number.

Converts a number to the string representation of that number.

convertStringToNumber

input (String)—A string to be converted to a number.

The numeric representation of the input string.

Converts a string to a number. If the input string is not a valid number, this function produces an error. If the input is a string representation of a special number ("NaN", "Infinity", "-Infinity", or "-0"), then the result contains the corresponding numeric representation.

currentEpochMicrosecondsLong

No parameters.

The current number of microseconds since the epoch.

Returns the current number of microseconds since the epoch (1970-01-01T00:00:00Z).

currentEpochMillisecondsLong

No parameters.

The current number of milliseconds since the epoch.

Returns the current number of milliseconds since the epoch (1970-01-01T00:00:00Z).

currentEpochSecondsLong

No parameters.

The current number of seconds since the epoch.

Returns the current number of seconds since the epoch (1970-01-01T00:00:00Z).

currentUtcZonedDateTime

No parameters.

The current date and time in UTC.

Returns the current date and time in UTC.

decodeStringByBase64

input (String)—A Base64-encoded string to decode.

The decoded UTF-8 string.

Decodes the specified Base64-encoded string to a string. The alphabet used is as specified in Table 1 of RFC 4648 and RFC 2045. UTF-8 encoding is used to convert the decoded bytes to a string.

decodeStringByBase64Mime

input (String)—A Base64-encoded string to decode.

The decoded UTF-8 string.

Decodes the specified MIME type Base64-encoded string to a string. The alphabet used is as specified in Table 1 of RFC 2045. The encoded output must be represented in lines of no more than 76 characters each and use a carriage return '\r' followed immediately by a line feed '\n' as the line separator. UTF-8 encoding is used to convert the decoded bytes to a string.

decodeStringByBase64Url

input (String)—A Base64-encoded string to decode.

The decoded UTF-8 string.

Decodes the specified Base64-encoded string that uses a URL-safe alphabet to a string. The alphabet used is as specified in Table 2 of RFC 4648, where '+' is replaced by '-', and '/' is replaced by '_'. UTF-8 encoding is used to convert the decoded bytes to a string.

encodeStringByBase64

input (String)—A string to encode.

The Base64-encoded string.

Encodes a string into its Base64 representation. The alphabet used is as specified in Table 1 of RFC 4648 and RFC 2045. No line feed (line separator) character is used. Before Base64 encoding, UTF-8 serialization is used to convert the string into bytes.

encodeStringByBase64Mime

input (String)—A string to encode.

The Base64-encoded string.

Encodes a string into the MIME variant of its Base64 representation. The alphabet used is as specified in Table 1 of RFC 2045. The encoded output is represented in lines of no more than 76 characters each and uses a carriage return '\r' followed immediately by a line feed '\n' as the line separator. No line separator is added to the end of the encoded output. Before Base64 encoding, UTF-8 serialization is used to convert the string into bytes.

encodeStringByBase64Url

input (String)—A string to encode.

The Base64-encoded string.

Encodes a string into its Base64 representation with URL and filename safe alphabet. The alphabet used is as specified in Table 2 of RFC 4648, where '+' is replaced by '-', and '/' is replaced by '_'. No line feed (line separator) character is used. Padding characters '=' are omitted in the encoded value. Before Base64 encoding, UTF-8 serialization is used to convert the string into bytes.

floorNumberToDouble

input (Number)—A number to round down.

The floor of the input value.

Rounds down a number to the nearest whole value. The result is always a whole number, but is represented in a floating-point format. For example, the floor of 4.3 is 4.0 and the floor of -4.3 is -5.0. If the input is NaN (Not a Number), infinite, positive zero, or negative zero, then the returned value is the same as the input.

getCharFromStringByIndex

input (String)—A string to search.

index (Number)—The index of the character to return.

The character (as a string) at the specified index.

Returns the character at the specified index of the input string. An index of 0 denotes the first character of the string. Throws an exception if the index is out of bounds.

getElementFromArrayByIndex

input (Object[])—An array of objects.

index (Number)—The zero-based index of the element to retrieve.

The element at the specified index.

Returns the element at the specified index from the input array. The index is zero-based. If the index is negative or out of range of the array, this function produces an error.

getFirstElementFromArray

input (Object[])—An array of objects.

The first element of the array.

Returns the first element from the input array.

getIndexOfSubstringFromString

input (String)—A string to search.

substring (String)—The sequence of characters to search for.

The index of the first occurrence of the substring, or -1 if not found.

Finds the index of the first occurrence of the specified substring. An index of 0 denotes the first character of the string. Returns -1 if the substring is not found.

getLastElementFromArray

input (Object[])—An array of objects.

The last element of the array.

Returns the last element from the input array.

getLastIndexOfSubstringFromString

input (String)—A string to search.

substring (String)—The sequence of characters to search for.

The index of the last occurrence of the substring, or -1 if not found.

Finds the index of the last occurrence of the specified substring in the input string. An index of 0 denotes the first character of the string. Returns -1 if the substring is not found.

getLengthOfString

input (String)—A string.

The length of the input string.

Returns the number of characters in the input string.

getMaximumFromNumberArray

input (Number[])—A numeric array.

The maximum value as a double.

Returns the maximum numeric value from the input array. The result is returned as an IEEE 754 double-precision (64-bit) floating-point value. All elements must be numeric. Returns 0 for an empty array. If any element is not a number, this function produces an error.

getMinimumFromNumberArray

input (Number[])—A numeric array.

The minimum value as a double.

Returns the minimum numeric value from the input array. The result is returned as an IEEE 754 double-precision (64-bit) floating-point value. All elements must be numeric. Returns 0 for an empty array. If any element is not a number, this function produces an error.

getSizeOfArray

input (Object[])—An array of objects.

The size of the array.

Returns the number of elements in the input array. Returns 0 for an empty array.

isArrayContainsAnyString

input (String[])—An array of objects to search.

value (String)—The value to search for.

True if the array contains the value, false otherwise.

Checks whether the input array contains at least one element equal to the specified string value. Non-string values are converted to string before comparison.

isStringContainsSubstring

input (String)—A string to search.

substring (String)—The sequence of characters to search for.

The boolean true if the specified substring is found, false otherwise.

Returns true if the specified substring is found anywhere in the input string.

isStringEndsWithSuffix

input (String)—A string to search.

suffix (String)—The suffix string to search for.

The boolean true if the input string ends with the suffix, false otherwise.

Returns true if the input string ends with the specified suffix.

isStringNullOrEmpty

input (String)—A string to evaluate.

The boolean true if the input string is null or empty, false otherwise.

Returns true if the input string is null or an empty string.

isStringStartsWithPrefix

input (String)—A string to search.

prefix (String)—The prefix string to search for.

The boolean true if the input starts with the prefix, false otherwise.

Returns true if the input string starts with the specified prefix.

joinArrayToString

input (Object[])—An array of objects to join.

delimiter (String)—The delimiter to place between elements.

The string containing all elements joined by the delimiter.

Joins all elements of the input array into a single string, separating each element with the specified delimiter. Each element is converted to its string representation. Null elements are converted to empty strings.

joinString

delimiter (String)—The character or characters to insert between the elements being joined.

inputs (String[])—An array of strings to be joined.

The joined string.

Joins an array of strings with the specified delimiter. The delimiter can be multiple characters. If an element of the array is null, then the string "null" is added to the result.

lowerCaseString

input (String)—A string to be converted to lower case.

The lower-cased string.

Converts a string to lower case.

maskNumber

input (Number)—A number to mask.

mask (Number)—The mask to apply to the input number.

The masked number.

Masks a number by replacing it with the specified number. Note: The original value is not retrievable.

maskStringByPosition

input (String)—A string to mask.

mask (char)—The mask character to use.

visibleCharCount (Number)—The number of characters to leave unmasked (positive: first n, negative: last n).

The masked string.

Masks all but the specified number of characters in the input string. If the specified number of characters is negative, the last n characters remain unmasked; if positive, the first n characters remain unmasked.

maskString

input (String)—A string to mask.

mask (String)—The mask to apply to the input string.

The masked string.

Masks a string by replacing it with the specified string. Note: The original value is not retrievable.

replaceStringByChar

input (String)—A string.

oldChar (char)—The character to be replaced.

newChar (char)—The character to replace the specified character.

The resulting string after replacement.

Replaces all instances of oldChar with newChar in the input string.

replaceStringBySubstring

input (String)—A string.

substring (String)—The substring pattern to match.

replacement (String)—The string to replace the specified substring.

The resulting string after replacement.

Replaces all instances of substring with newString in the input string.

roundNumberToLong

input (Number)—A number to round.

The closest whole number to the input.

Rounds a number to the closest whole number. Values that have 0.5 as their fractional parts round toward positive infinity. If the input is NaN (Not a Number), the result is 0. If the input is negative infinity or any value less than or equal to the value of -2^63, the result is equal to the value of -2^63. If the input is positive infinity or any value greater than or equal to the value of (2^63)-1, the result is equal to the value of (2^63)-1.

splitString

input (String)—A string to split.

delimiter (String)—The delimiter to split the string by.

numSplits (Number)—The number of elements in the result array.

The array of splits.

Splits a string into the parts that are separated by the specified delimiter. The delimiter is not included in the result. If the input string does not contain enough splits to fill the result array, the remaining array elements contain empty strings. If the string contains more splits than the result array can hold, the last element of the result array contains the remaining substring.

splitStringToArray

input (String)—A string to split.

delimiter (String)—The delimiter to split the string by.

numSplits (Number)—The number of elements in the result array.

The array of splits.

Splits a string into the parts that are separated by the specified delimiter. The delimiter is not included in the result. If the input string does not contain enough splits to fill the result array, the remaining array elements contain empty strings. If the string contains more splits than the result array can hold, the last element of the result array contains the remaining substring.

substringString

input (String)—A string.

startIdx (Number)—The starting index of the substring.

length (Number)—The length of the substring.

The substring.

Extracts a substring from a string, based on a starting index and a length. An index of 0 denotes the first character of the string.

trimString

input (String)—A string to trim.

The trimmed string.

Removes the whitespace from both ends of a string.

upperCaseString

input (String)—A string to be converted to upper case.

The upper-cased string.

Converts a string to upper case.