The following variable and data types can be used in variable transformations:
Variable Types:
Data Types:
String
Number
Date / Date Math
List
JSON
Depending on the data variable type, the following operations are supported:
Operation | Data Type | Description |
Lowercase | String | Convert a string to lowercase |
Uppercase | String | Convert a string to uppercase |
Trim | String | Returns a text value with the leading and trailing spaces removed |
TrimPrefix | String | Returns a text value with the leading spaces removed |
TrimSuffix | String | Returns a text value with the trailing spaces removed |
Replace | String | Replaces a string |
Split | String | Splits a string |
Capitalize | String | Capitalizes the entire string |
Titleize | String | Capitalizes the first letter of all individual words in a string |
PadLeft | String | Adds spaces to the left of the string |
PadRight | String | Adds spaces to the right of the string |
Parse Text as JSON | String | Convert text formatted as JSON to a proper JSON output for use in subsequent OneCloud Commands |
Parse Number | String | Convert numbers that are stored as text to a number |
Add | Number | Adds a value to a number |
Subtract | Number | Subtracts a value from a number |
Multiple | Number | Multiples a number by a value |
Divide | Number | Divides a number by a value |
Round | Number | Rounds a number to the specified number of decimal places |
Date & Time Format | String Date/Time | Format Date/DateTime strings |
Date Math | String Date/Time | Add/subtract time units from a Date/DateTime |
Sort | List | Sort a list based in ascending or descending order |
Pick from List | List | Pick an individual element from a list. (0 for the first and -1 for the last element) |
JSON Parsing | JSON | Pick individual elements from a proper JSON text string |
String Transformation
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.
Example:

Number 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.
Date Transformation
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.
Format | Example |
%m-%d-%Y | 01-30-2020 |
%H:%M | 21:08 |
📓 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.
Example:

Date Math
Date math transformations enable timestamps to be added or subtracted based upon the following parameters:
Format | ISO extended or custom date format |
Operation | Add/ Subtract |
Amount | Numeric value |
Unit |
|
Example:

List Transformation
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'.
Example:

JSON Transformation
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)
Example:
[{
"email": "demo@onecloud.io",
"decision": "rejected",
"decidedAt": "2019-01-13T22:59:52.018377",
"comment": "Please review again"
}, {
"email": "demo@onecloud.io",
"decision": "approved",
"decidedAt": "2020-01-13T22:59:52.018377",
"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.

Results:
