The following variable and data types can be used in variable transformations:
Date / Date Math
Depending on the data variable type, the following operations are supported:
Convert a string to lowercase
Convert a string to uppercase
Returns a text value with the leading and trailing spaces removed
Returns a text value with the leading spaces removed
Returns a text value with the trailing spaces removed
Replaces a string
Splits a string
Capitalizes the entire string
Capitalizes the first letter of all individual words in a string
Adds spaces to the left of the string
Adds spaces to the right of the string
Parse Text as JSON
Convert text formatted as JSON to a proper JSON output for use in subsequent OneCloud Commands
Convert numbers that are stored as text to a number
Adds a value to a number
Subtracts a value from a number
Multiples a number by a value
Divides a number by a value
Rounds a number to the specified number of decimal places
Date & Time Format
Format Date/DateTime strings
Add/subtract time units from a Date/DateTime
Sort a list based in ascending or descending order
Pick from List
Pick an individual element from a list. (0 for the first and -1 for the last element)
Pick individual elements from a proper JSON text string
String transformation enables any variable that is of data type string to be transformed to upper or lower case as well as parsed and converted to a JSON data type.
To start a transformation, select the variables and select the required transformation.
Number transformation allows mathematic operations to be performed on both numbers and numbers stored as strings (text).
For numbers stored as strings, the Parse Number Transformation must be applied before any of the Number Transformations can be applied.
Data transformation allows Date/DateTime strings to be transformed into various formats based upon strftime formatting symbols. For a comprehensive description of the format specifier, please refer to this strftime format guide. These formatting characters can then be combined with other separator characters such as the following characters: , : / .
The following table illustrates various format strings and the corresponding format.
📓 Using Date Transformation with OneCloud Chain.ExecutionDateTime
If using the OneCloud System Variable, Chain.ExecutionDateTime, the Input Date Time Zone should be (UTC) Dublin, Edinburgh, Lisbon, London, since this reflects OneCloud's base timezone.
Date math transformations enable timestamps to be added or subtracted based upon the following parameters:
ISO extended or custom date format
Lists can be sorted in ascending or descending order, and specific elements can be extracted from a list. In the example below, the first Command lists the files in a directory, and the list output from the first Command is first sorted, and then the first value of that list is extracted.
📓 List Output
List transformation will only operate with Command outputs of the type 'List'.
Many public Rest APIs provide responses in a JSON format. The data in the response can be transformed and used within your chain. There are a few simple things to remember when using JSON transformations:
Elements in a list within JSON use zero-based indexing (this first element is at the zero index).
Reference the element name on the left
Match the element type (string, list, or JSON)
"comment": "Please review again"
"comment": "Looks great!"
The example JSON above is a response from OneCloud Human Integration Workflow. If the second decision element is in the list to be selected, then a transformation would be added as follows:
Add a variable transformation on a variable that holds JSON (see example JSON above).
Add the first transformation `Parse Text as JSON`.
Add the second transformation `Get Value from JSON` and select the elements in the array.