To ease their use as command inputs within a chain, you can apply transformations to a variable or command output. You can apply multiple transformations to a command input, such as to further transform its data or the output of its transformation.
Transformations
Transformation | Data Type | Description |
---|---|---|
Parse text as JSON | Text string | Converts a string to JSON |
Parse number | Text string | Converts a numerical string to a number |
Lowercase | Text string | Converts a string to lowercase |
Uppercase | Text string | Converts a string to UPPERCASE |
Capitalize | Text string | Capitalizes an entire string |
Titleize | Text string | Capitalizes the first letter of each word in a string |
Trim | Text string | Removes leading and trailing spaces from a string |
Trim prefix | Text string | Removes leading spaces from the start of a string |
Trim suffix | Text string | Removes trailing spaces from the end of a string |
Pad left | Text string | Add spaces to the left of a string to extend it to a specific length |
Pad right | Text string | Add spaces to the right of a string to extend it to a specific length |
Replace | Text string | Replaces values in a string based on an exact match or regular expression |
Split | Text string | Splits a string based on a delimiter value |
Add | Number | Adds a value to a number |
Subtract | Number | Subtracts a value from a number |
Multiply | Number | Multiplies 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 |
Parse date/time | Text string | or Date or TimestampConverts a date or timestamp to a specific format and time zone |
DateMath | Date or Timestamp | Adds or subtracts days, months, years, hours, or minutes to or from a timestamp |
Date & time format | Date or Timestamp | Formats a date or timestamp |
Sort | List | Sorts the items in a list in ascending or descending order |
Pick from list | List | Gets an individual element from a list |
Get value from JSON | JSON | Converts an individual element from a proper JSON string to a string, list, or JSON |
Note: When you use a JSON output as the property of another command, you can select a specific element from the output instead of its full JSON string. If you select an element instead of the full string, apply the Get Value from JSON transformation to convert its data type.
Parse text as JSON
To convert a text variable or output to JSON, apply the Parse Text as JSON transformation:
- In the chain, select the node of the command with the input to transform, and click Edit .
- Under Command Properties, click the variable or output to transform.
- Select Parse text as JSON, and click Add
Note: To also retrieve an element from the JSON, select Get Value from JSON and click Add
to apply an additional transformation.
.
- Click Accept.
Update the capitalization of a string
To convert a text string variable or output to all uppercase or lowercase, apply the Uppercase or Lowercase transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select the transformation to apply:
- To capitalize the first letter in each word of the string, select Titleize.
- To convert the string's characters to all uppercase, select Uppercase or Capitalize.
- To convert the string's characters to all lowercase, select Lowercase.
Note: To transform the string, select the additional transformation to apply and click Add
. - Click Accept.
Add or remove trailing or leading spaces on a string
To add or remove spaces from the start or end of a text string variable or output, apply a Pad or Trim transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select the transformation to apply, and click Add
- To add leading spaces to the start of the string, select Pad Left, and enter the total length of the string.
- To add trailing spaces to the end of the string, select Pad Right, and enter the total length of the string.
- To remove leading spaces from the start of the string, select Trim Prefix.
- To remove trailing spaces from the end of the string, select Trim Suffix.
- To remove spaces from both the start and end of the string, select Trim.
Note: To transform the string output, select the additional transformation to apply and click Add
.
:
- Select Accept.
Split a string
To split a text string variable or output based on a delimiter value, apply the Split transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Split, and click Add .
- For Delimiter, enter the text value at which to split the string.
Note: To transform the string output, select the additional transformation to apply and click Add
. - Select Accept.
Replace a value in a string
To replace a value within a text variable or output with another value, apply the Replace transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Replace, and click Add .
- In Find, enter the criteria of the value to replace in the string as the exact text to match or a regular expression.
- In Replacement, enter the value to replace text that matches the Find criteria.
- In Match Type, select whether to search for the Find criteria by an Exact match or regular expression (RegEx).
Note: To transform the string output, select the additional transformation to apply and click Add
. - Click Accept.
Add, subtract, multiply, divide, or round numbers
To perform a mathematical operation on a number value, apply an Add, Subtract, Multiply, Divide, or Round transformation.
Tip: To perform a mathematical operation on a numerical string value, first apply a Parse number transformation.
- For an Add or Subtract transformation, enter how much to increase or decrease the number by.
- For a Multiply or Divide transformation, enter how much to multiply or divide the number by.
- For a Round transformation, enter how many decimal spaces to round the number to.
Parse a date or timestamp as a string
To convert a date or timestamp variable or output to a specific format and timezone, apply the Parse Date/Time transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Parse Date/Time, and click Add .
- Select whether to use the standard International Organization for Standardization (ISO) or a custom format with the date or timestamp.
- Enter how to format date or time values using strftime formats and separators such as
.
,,
,:
, or/
. For example,%m-%d-%Y
for 01-30-2020, or%H:%M
for 21:08. - To change the time zone of the date or timestamp, select the time zones for the input and output values.
Note: To transform the string output, select the additional transformation to apply and click Add
. - Click Accept.
Add or subtract a date or timestamp
To add or subtract an interval value to or from a date or timestamp variable or output, apply the Add/Subtract Date and Time transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Add/Subtract Date and Time, and click Add .
- Select whether to use the standard International Organization for Standardization (ISO) or a custom format.
- For Operation, select whether to Add or Subtract the timestamp.
- Enter the increment to add to or subtract from the timestamp, such as 1 Day.
Note: To change the format of the timestamp, select Parse Date/Time and click Add
to apply an additional transformation. - Click Accept.
Sort items in a list
To sort the items in a list variable or output in ascending or descending order, apply the Sort List transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Sort List, and click Add .
- Select whether to sort the list in Ascending or Descending order.
Note: To pick a string element from the list, select Pick from List and click Add
to apply an additional transformation. - Click Accept.
Pick elements from a list
To extract an individual element from a list variable or output, apply the Pick from List transformation:
- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Pick from List, and click Add .
- For Value, enter the index number of the element to pick;
0
for the first element,-1
for the last.Note: To transform the string element, select the additional transformation to apply and click Add
. - Click Accept.
Get values from JSON
To convert an individual element from a JSON variable or output to a string, list, or JSON, apply the Get Value from JSON transformation. When using the transformation. elements in a list within the JSON use a zero-based index, where the first value has an index of 0
.
Note: To determine the index and name of the element to parse with the transformation, click Monitor
, and view the command's JSON output.- In the chain, select the command with the input to transform and, under Command Properties, click the variable or output to transform.
- Select Get Value from JSON, and click Add
- Select whether to output the element as a text string , list , or JSON .
- For Value, enter:
- If the JSON includes multiple objects, the index of the object to extract from, starting with 0. For example, for the second object, enter
1
.Note: Enter the index only if the JSON includes multiple objects.
- The name of the element to pick, such as
id
.
Note: To transform the output from the transformation, such as to format a date string or sort a list, select the additional transformation to apply and click Add
. - If the JSON includes multiple objects, the index of the object to extract from, starting with 0. For example, for the second object, enter
- Click Accept.