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.
    1.Select_Transform_Connector.png
  2. Select the Transform action.
    2.Select_Transform_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)}” } 3.Add_JSON_Code_in_Transformation.png
  5. Click on Proceed.
  6. Click on Test Action to execute the JSON code.
    4.Click_Test_Action.png
  7. You should see the output with the first letter capitalized. Click Save and Exit for the Transform process flow.
    5.Click_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:
6.Capitalize_Output.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:
7.CamelCase_Output.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:
8.KebabCase_Output.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:
9.SnakeCase_Output.png

escape

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

Here’s a screenshot that shows the output:
10.Escape_Output.png

split

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

Here’s a screenshot that shows the output:
11.Split_Output.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:
12.Join_Output.png

Here’s a screenshot that shows the input and output:
13.Join_Output_Two.png

number

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

Here’s a screenshot that shows the output:
14.Number_Output.png

sum

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

Here’s a screenshot that shows the output:
15.Sum_Output.png

random

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

Here’s a screenshot that shows the output:
16.Random_Output.png

max

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

Here’s a screenshot that shows the output:
17.Max_Output.png

min

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

Here’s a screenshot that shows the output:
18.Min_Array_Output.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:
19.UpperCase_Output.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:
20.Lower_Case_Output.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:
21.Text_Output.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:
23.Unique_Items_Output.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:
24.FindIn_Collection_Input.png

Here’s a screenshot that shows the output:
25.FindIn_Collection_Output.png

filterCollection

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

Here’s a screenshot that shows the output:
26.Filter_Collection_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:
27.Map_Collection_Output.png

size

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

Here’s a screenshot that shows the output:
28.Size_Output.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:
29.Now_Output.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:
30.UUID_Output.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:
31.Using_Multiple_Filters.png

This sets up the Transform action connector

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^