Transform

The Transform action connector helps in manipulating texts and numbers as required. It helps you to manipulate and structure data according to our needs.
For example, suppose in the previous trigger specific data is selected to be displayed. In that case, the action defined by the Transform connector can manipulate or change it to meet your display requirements.

Set Up the Transform modifiers

Perform the following steps to set up the Transform action connector:

  1. In the Configure Action section, click the Transform connector.
    Select-Connector.png
  2. Select the Transform action.
    Select-Action.png
  3. Click on Add Input, and enter a variable name for the Input Name (say, “name”) and an Input Value for the variable (say, “john” in lowercase letters) (see screenshot in next step).

    Note: You can even pass the value directly into the Transformation box.

  4. Let’s enter the JSON code that uses the “capitalize()” modifier in the Transformation box. Use the following code: {“result” : “{capitalize(name)}” }
    Transformation-box-details.png
  5. Click on Proceed.
  6. Click on Test Action to execute the JSON code.
    Test-Action.png
  7. You should see the output with the first letter capitalized. Click Save and Exit for the Transform process flow.
    Save-Exit.png

Transform Modifiers

Transform modifiers help in manipulating texts and numbers as per our needs. This function utilizes JSON code and modifiers to transform data.
The Transform connector also helps in mapping different JSON objects into one object, as seen in the sample transform input data:

{
  "first_name" : "{user_first}",
  "last_name" : "{user_last}",
  "full_name" : "{join(user_first,user_last,' ')}",
  "country" : "india",
  "time" : "{now('toISO')}"
}

The Transform function has specific modifiers that can manipulate the data. Let’s look at the applicable transform modifiers in detail.

capitalize

Use this modifier to convert the input data into the capital (upper) case.
Example: capitalize('input data') or capitalize(variable)

Here’s a screenshot that shows the output:

Capitalize.png

camelCase

Use this modifier to convert the input text into the camel case.
Example: camelCase('input data')

Here’s a screenshot that shows the output:

CamelCase.png

kebabCase

Use this modifier to convert the input text into the kebab case.
Example: kebabCase('input data')

Here’s a screenshot that shows the output:

KebabCase.png

snakeCase

Use this modifier to convert the input text into the snake case.
Example: snakeCase('input data')

Here’s a screenshot that shows the output:

snakeCase.png

escape

Use this modifier to escape HTML characters.
Example: escape('<data input>')

Here’s a screenshot that shows the output:

Escape.png

split

Use this modifier to split the text into an array.
Example: split('data-input' , '-')

Here’s a screenshot that shows the output:

Split.png

join

Use this modifier to join all items of an array to make a single string.
Example: join(…arrayRef|string , '-')

Here’s a screenshot that shows the input:

Join-Input.png

Here’s a screenshot that shows the input and output:

Join-Output.png

number

Use this modifier to convert text into numbers.
Example: number('3')

Here’s a screenshot that shows the output:

Number.png

sum

Use this modifier to perform the addition of all numbers.
Example: sum(5,10,2)

Here’s a screenshot that shows the output:

Sum.png

random

Use this modifier to generate random numbers from a specified range.
Example: random(1, 50)

Here’s a screenshot that shows the output:

Random.png

max

Use this modifier to retrieve the largest number from an array.
Example: max(arrayRef)

Here’s a screenshot that shows the output:

Max.png

min

Use this modifier to retrieve the smallest number from an array.
Example: min(arrayRef)

Here’s a screenshot that shows the output:

Min.png

upperCase

Use this modifier to convert the input text into upper case.
Example: upperCase('hello world')

Here’s a screenshot that shows the output:

UpperCase.png

lowerCase

Use this modifier to convert the input text into lower case.
Example: lowerCase('Hello World')

Here’s a screenshot that shows the output:

Lowercase.png

text

Use this modifier to convert numbers to the text type, i.e., this modifier typecasts data which means that the data type gets changed to string.
Example: text(3)

Here’s a screenshot that shows the output:

Text.png

uniqueItems

Use this modifier to remove duplicate items from an array.
Example: uniqueItems(arrayRef)

Here’s a screenshot that shows the input:
22.Unique_Items_Input.png

Here’s a screenshot that shows the output:

UniqueFilter.png

findInCollection

Use this modifier to return objects from an array specified in the conditions.
Example: findInCollection(collectionRef, 'name=bob&type=author')

Here’s a screenshot that shows the input:

FindIncollection-Input.png

Here’s a screenshot that shows the output:

FindInCollection-Output.png

filterCollection

Use this modifier to filter an array and remove all objects which do not match the condition.
Example: filterCollection(collectionRef, 'name=Rahul')

Here’s a screenshot that shows the output:

FilterCollection-Output.png

mapCollection

Use this modifier to map the collection data. This function will help users create a new collection by mapping data to different keys.
Example: { "userslist": "{mapCollection(users,'email_id=email&job=occupation')}" }

Here’s a screenshot that shows the output:

Mapcollection.png

size

Use this modifier to retrieve the size of an array.
Example: size(...arrayRef)

Here’s a screenshot that shows the output:

Size.png

now

Use this modifier to retrieve the current timestamp.
Example: now('toISO')
Options: toISO | toDate | toGMT | toUTC | toTime

Here’s a screenshot that shows the output:

ISO.png

uuid

Use this modifier to retrieve the unique ID based on UUID v4.
Example: uuid() { "uuid" : "{uuid()}"}

Here’s a screenshot that shows the output:

UUID.png

Using Multiple Filters

You can also pass data in for more than one filter, as shown below:
{ “name”: “{lowerCase(firstname)|upperCase($pipe)}” }

Here’s a screenshot that shows the output:

Multiple-Filters.png

This sets up the Transform action connector

Was this article helpful?

Thanks for your feedbackSmile-icon

More articles in "Utility"

On This Page

^