Expressions: Definitions and Usage Examples
Expressions convert input into certain formats or perform operations with the input.

Text Expressions
It returns true if the value contains the input value, otherwise false.


Concat
It is used to concatenate a string to the end of another string.
(We have to enclose the statements in single quotation marks.)




Lower
It is used to convert a string to a lowercase.


Upper
It is used to convert a string to uppercase.


Replace(input, target, replacement)
It is used to replace all occurrences of a specified target substring within the input string with a given replacement substring.


Substring
It returns the substring that is between the start and the end index. (end character will not be included)
For this case, start index: 0, end index: 4



Capitalize
It capitalizes the first character of the input and converts remaining characters to lowercase.
Length
Calculate the length of the string.

indexOf
Returns the index of the first occurrence of a specified value in a string. (Index starts from “0”.)

lastIndexOf
Returns the index of the last occurrence of a specified value in a string. (Index starts from “0”.)


removeNonAscii
Removes all non-ASCII characters from a text string.
split
Splits a string into an array of strings by separating the string into substrings.

findMatchingSubstringWithRegex(input, regex, returnMode)
It is used to find the first substring in the input string that matches the given regular expression. It returns a string containing either the first matched substring (if returnMode is "0"), or an array containing all matched substrings (if returnMode is "1").
Regex pattern:
\b(?:https?|ftp):\/\/[-A-Za-z0-9+&@#\/%?=~_|!:,.;]*[-A-Za-z0-9+&@#\/%=~_|]\b
Explanation: Matches URLs, such as https://www.example.com
Regex pattern:
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b
Explanation: Matches email addresses, such as: joe@email.com
Regex pattern:
\b\d{2}\/\d{2}\/\d{4}\b
Explanation: Matches dates in MM/DD/YYYY format, such as 10/25/2024
Regex pattern:
\b\d{3}-\d{2}-\d{4}\b
Explanation: Matches number format xxx-xx-xxxx 123-45-6789





lookup(data, key)
It is used to look up a value associated with a given key in an array of pairs. It returns the value associated with the given key, or an empty string if the key is not found.
Example Key-Value Table Representation:
Key | Value |
---|---|
Yes | Y |
No | N |
Product | Prod |
Prod | Production |
With transformation connector:
{"assets":[["Yes","Y"],["No","N"],["Product","Prod"],["Prod","Production"]]}
{"assets":[["countryOfOrigin","United States"],["supplierItemCode","115596"],["caseGtinUpc","00815154026376"],["retailGtinUpc","00815154026369"],["unitGtinUpc","00815154026369"],["retailUnitLength","2.28"]]}
{"assets":[["Value1","Key"],["Value2","Key"],["Key","TrueValue"],["Value3","Key"]]}
{"assets":[["Key1","Value1"],["Key2","Value2"],["Key3","Value3"],["Key1","Value4"]]}



Output of this step:


escapeHTML
Escapes all HTML tags in text.
You can test escapeHTML conversion from here: https://www.freeformatter.com/html-escape.html#before-output
removeHTML
Removes all HTML tags from text.
convertXMLToJson
It is used to convert the given xml string to the json.


trim
It is used to trim leading and trailing whitespace from the input string. It removes whitespace from the beginning and end of the provided string. Any internal whitespace within the string is not affected.
Currently, we are entering inputs with single quotes at the beginning and end, but after this development is deployed, there will be no need to use single quotes.


Encode/Decod
Expressions
transformToBase64
Transforms string to base64.
You can test base64 conversion from here: https://base64.guru/converter
decodeBase64
It is used to decode base64 to string.


You can test from here: https://base64.guru/converter/decode
decodeURL
Decodes special characters in URL.
You can test decode/encode url from here: https://onlinetexttools.com/url-decode-text
encodeURL
Encodes special characters in a text to a valid URL address.
transformToHex
Converts string to hex data.
You can test string to hex conversion from here: https://codebeautify.org/string-hex-converter
calculateMD5
Calculates the md5 hash of a string.
You can test MD5 hash of a string from here: https://www.md5hashgenerator.com/
calculateSHA1
Calculates the sha1 hash of a string.
You can test SHA1 hash of a string from here: https://10015.io/tools/sha1-encrypt-decrypt
calculateSHA256
Calculates the sha256 hash of a string.
You can test SHA256 hash of a string from here: https://10015.io/tools/sha256-encrypt-decrypt
calculateSHA512
Calculates the sha512 hash of a string.
You can test SHA256 hash of a string from here: https://10015.io/tools/sha512-encrypt-decrypt
Array Expressions
addToArray
Adds the value in the input parameter to the array and returns the resulting array.
arrayContains
Checks if an array contains the value.
removeDuplicate
Removes duplicates from an array.
findFirstInArray
Returns the first element of the array.
findLastInArray
Returns the last element of the array.
removeItemWithIndex
Removes the item with given index from the given array. (index starts from 0)
clearArray
Clears an array and returns the empty array.
reverseArray
Reverses the elements of an array.
shuffleArray
Shuffles (randomly reorders) elements of an array.
sliceArray
Slices the elements of an array based on the start and end index, and returns a new array containing only selected items between start and end index.
Start index will be included.
End index will be excluded.
sortArray
Sorts the elements of an array based on the order parameter.




Order parameter should be either ‘asc’ or ‘desc’
asc - ascending order: 1, 2, 3, ... for type Number. A, B, C, a, b, c, ... for type Text.
desc - descending order: ..., 3, 2, 1 for type Number. ..., c, b, a, C, B, A for type Text.
You can check order from here: https://www.isko.org/cyclo/alphabetization
joinArray
Concatenates all the items of an array into a string, using a specified separator between each item.
mergeArrays
Merges two arrays into one array and returns new array that contains all the items of first array and second array.
flattenArray
Creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.
transposeArray
Transposes the given array and returns resulting array.
Example for transpose:
toArray
Converts a collection into an array of key-value collections.

toCollection
Converts an array containing key-value pairs into a collection.

getRowSize
Returns the row size of an array.
getColumnSize
Returns the column size of an array. If sizes of the columns different in multidimensional arrays, it returns max column size as in ar2D.
Omit
It removes the input key from the input array and returns the remaining elements.
Pick
Returns all values that match the input key in the input array.
Logic Expressions
isEmpty
It checks whether the given input is empty or not. If empty, it returns true, otherwise false. Input can be a string, an array or an json object.
If
If the condition in the first input is true, it returns the value in the second input which is the true case, if the condition is false it returns the value in the third input which is false case.
If inside if:
We can also use another expression witfin the if expression as below:
General Expressions
getFromJsonPath
We enter a json into the first input and into the second input we enter the path of the variable we want to get from this json. It returns the value found in the path we entered.
{"test":{ "firstName": "John", "lastName": "doe", "age": 26, "address": { "streetAddress": "naist street", "city": "Nara", "postalCode": "630-0192" }, "phoneNumbers": [ { "type": "iPhone", "number": "0123-4567-8888" }, { "type": "home", "number": "0123-4567-8910" } ] }}
Math Expressions
ceil(number)
It returns the smallest integer greater than or equal to a specified number.


floor(number)
It returns the largest integer less than or equal to a specified number.


formatNumber(number, decimalPoints, decimalSeparator, thousandsSeparator)
It is is used to format a number according to the provided parameters, and returns the formatted number.


parseNumber(number, decimal separator)
It parses a string with a number and returns the parsed number.


roundNumber(number)
It is used to round a numeric value to the nearest integer.


convertScientificToDecimal(scientific notation)
It is used to convert a number from scientific notation of the form "nx10^E" to decimal number.
convertDecimalToScientific(decimal number)
It is is used to convert a decimal number to scientific notation of the form "nx10^E" where n is the significand and E is the exponent.


convertDecimalToENotation(decimal number)
It is used to convert a decimal number into scientific E notation. The scientific notation will be formatted to include all significant digits with an 'E' indicating the exponent.


convertENotationToDecimal(E notation)
It is used to convert a number from E notation to a decimal number. It takes the input number in E notation with an 'E' or 'e' indicating the exponent.


You can test conversions from here: https://www.calculatorsoup.com/calculators/math/scientific-notation-converter.php
For more information about scientific notation and e notation:
https://en.wikipedia.org/wiki/Scientific_notation
https://en.wikipedia.org/wiki/Scientific_notation#E_notation
sum(array of numbers)
It is used to calculate the sum of numeric values in an array. It handles both integers and doubles, and ignores non-numeric values in the array. If the array contains no numeric values, the method returns an empty string.




Date Expressions
currentDateTime(format)
It returns the current date with the specified format.


addDays (date, number)
It is used to add or subtract the specified number of days from the given date-time. Returns a new date as a result of adding a given number of days to a date. To subtract days, enter a negative number.


addHours (date, number)
It is used to add or subtract the specified number of hours from the given date-time. Returns a new date as a result of adding a given number of hours to a date. To subtract hours, enter a negative number.


addMinutes (date, number)
It is used to add or subtract the specified number of minutes from the given date-time. Returns a new date as a result of adding a given number of minutes to a date. To subtract minutes, enter a negative number.


addMonths (date, number)
It is used to add or subtract the specified number of months from the given date-time. Returns a new date as a result of adding a given number of months to a date. To subtract months, enter a negative number.


addSeconds (date, number)
It is used to add or subtract the specified number of seconds from the given date-time. Returns a new date as a result of adding a given number of seconds to a date. To subtract seconds, enter a negative number.


addYears (date, number)
It is used to add or subtract the specified number of years from the given date-time. Returns a new date as a result of adding a given number of years to a date. To subtract years, enter a negative number.


setSecond (date, number)
It is used to return a new date with the seconds specified in parameters. Accepts numbers from 0 to 59.


setMinute (date, number)
It is used to return a new date with the minutes specified in parameters. Accepts numbers from 0 to 59.


setHour (date, number)
It is used to return a new date with the hour specified in parameters. Accepts numbers from 0 to 23.


setDayOfWeek (date, name of the day in English)
It is used to return a new date with the day specified in parameters.


setMonth (date, name of the month in English)
It is used to return a new date with the month specified in parameters.


setYear (date, number)
It is used to return a new date with the year specified in parameters.


changeDayOfMonth(date, number)
It is used to return a new date with the day of the month specified in parameters. Accepts numbers from 1 to 31. If a number is given outside of the range, it will return the day from the previous or subsequent month(s), accordingly.


before(date1, date2, format)
It is used to check if date1 is before date2.


after(date1, date2, format)
It is used to check if date1 is after date2.


convertDate(date1, format1, format2)
It is used to convert a date string from one format to another.


convertDateToEpoch(date, dateFormat, epochFormat)
It is used to convert a date string to epoch time using the specified format. The format of the epoch should be "ms" for milliseconds, "s" for seconds, "us" for microseconds, "ns" for nanoseconds. If any parameters are invalid, empty, or null, the expression will return an empty string.


convertEpochToDate(epoch, dateFormat, epochFormat)
It is used to convert the given epoch time to a formatted date string based on the provided format. The format of the epoch should be "ms" for milliseconds, "s" for seconds, "us" for microseconds, "ns" for nanoseconds. If any parameters are invalid, empty, or null, the expression will return an empty string.


formatDateWithTimezone(date, input format, output format, timezone offset)
It is used to convert a date string from one format to another, adjusting for the specified timezone offset. This expression can handle both date strings that include timezone information (ZonedDateTime
) and those without timezone information (LocalDateTime
). It applies the given timezone offset to the date, then returns the date in the desired output format with the adjusted timezone.
date: 2024-09-10T14:19:58.999Z[UTC]
input format: yyyy-MM-dd'T'HH:mm:ss.SSSX'['z']'
output format: dd-MM-yyyy'T'HH:mm:ss
timezone offset: +3


date: Last Successful Completion Time (2024-11-22T12:08:37.466Z[UTC]
)
input format: yyyy-MM-dd'T'HH:mm:ss.SSSX'['z']'
output format: dd-MM-yyyy'T'HH:mm:ss
timezone offset: +3


Example Expressions
Getting File Name Without The Extension
In this example, we are removing the file extension, e.g., asset123.jpg
will be transformed into asset123
:
