Skip to content

Transform Data

The "Transform Data" block is a versatile tool that offers various data transformation operations. Each operation has unique behavior based on how it transforms data. These operations are grouped according to the data type they work with. Below are tables detailing each operation within its respective category.

Logic Operations

Logic operations in FlowRunner provide essential tools for making decisions within your flows. These operations allow you to evaluate conditions in preparation for more advanced flow control decisions based on specific criteria. By incorporating logic operations, you can create more dynamic and responsive workflows that adapt to various situations.

There are four main logic operations in FlowRunner:

  1. If: This operation checks a condition and returns one of two values based on whether the condition is true or false.
  2. Equals: This operation compares two values to determine if they are equal.
  3. Switch: This operation evaluates a value against a list of cases and returns a corresponding result for the first matching case.
  4. Is Empty: This operation checks if a value is empty and returns one of two specified values based on the result.

These logic operations work at a fundamental level, helping you to implement basic decision-making processes within your flows. They are versatile and can be used in a wide range of scenarios to ensure your automation behaves as expected under different conditions.

The details of each operation are described below.

Operation Description Arguments
If Returns "Yes" if the condition is satisfied, otherwise returns "No".
if sample
- Condition
- Yes
- No
Equal Compares two values to check if they are equal. Returns true if the values are equal or false otherwise.
equals sample
- Compare value
- With
Switch Evaluates a value against a list and returns the result corresponding to the first matching value.
switch sample
- Value or Expression to Evaluate
- Pairs of "For the Case Of" and "Return Value"
- Default
If Empty Returns the first value if the input is not empty, otherwise returns the second value.
switch sample
- Evaluate Value or Expression
- When Empty, Return

Object Operations

In programming, an "object" is a way to organize and store data. Think of an object as a collection of related information, much like a real-world object that has various characteristics. These characteristics are stored as key/value pairs within the object.

  • Key: This is the name of a property or attribute in the object. It serves as a label to identify the data.
  • Value: This is the data or information associated with the key. It can be any type of data, such as a number, text, or even another object.

Note

Elsewhere in this guide we use the term "key/value structure" to refer to objects.

Each key in an object maps to a value, and this mapping is unique. This means you can easily retrieve the value by using its corresponding key.

Let's look at a simple example of an object representing a person. Here are the keys and values in a tabular format:

Key Value
firstName James
lastName Bond
age 45
occupation Spy
email jamesbond@mi6.co.uk

In this example, the object has keys like firstName,lastName, age, occupation and email. Each key is associated with a specific value. To retrieve values from an object, you use the key names. For instance, if you want to find out the person's first name, you look up the value associated with the firstName key.

Here's how you can retrieve the values using their keys:

  • To get the first name: firstName -> James
  • To get the last name: lastName -> Bond
  • To get the age: age -> 45
  • To get the occupation: occupation -> Spy
  • To get the email: email -> jamesbond@mi6.co.uk

By using the key names, you can easily access and manipulate the data within the object. This makes objects a powerful and flexible way to handle complex data in programming. The operations listed below work with objects. You can retrieve a value associated with a specific key, or "transform" an object by omitting or selecting specific properties.

Operation Description Arguments
Get Retrieves the value of a specified property from an object or array. Use dot notation for nested key/value structures (objects).
get sample
- Object
- Property Name
Omit Omits specified keys from an object and returns the remaining properties.
omit sample
- Object
- Property Name(s)
Pick Picks only the specified keys from an object.
omit sample
- Object
- Property Name(s)

Array/List Operations

In programming, an "array" is a way to organize and store a collection of items. Think of an array as a list where you can keep multiple pieces of related information in one place. Each item in an array has a specific position, known as an index, which helps you access and manage the items easily. Arrays can contain data of different types, such as numbers, strings, objects or even other arrays.

Let's look at a simple example of an array representing a list of fruits:

"Apple", "Banana", "Cherry", "Date", "Elderberry"

In this array, each fruit is an item, and each item has an index:

Index Item
0 Apple
1 Banana
2 Cherry
3 Date
4 Elderberry

Here are some common operations you can perform on arrays:

  • Get Length - The length of an array is the number of items it contains. You can easily find out how many items are in an array by checking its length.
  • Get First Item - You can retrieve the first item in an array by accessing the item at index 0.
  • Sort - Sorting an array means arranging its items in a specific order, such as alphabetically or numerically.

Let's see these operations in action with our fruit array:

Operation Result
Get Length 5
Get First Item Apple
Sort Apple, Banana, Cherry, Date, Elderberry

Arrays are a powerful way to manage collections of related items in programming. Below is a list of array operations supported by FlowRunner. By using these operations you can efficiently organize and manipulate your data.

Operation Description Arguments
Create Array Creates an array from the provided elements. - Element
Convert List To String Concatenates all items of an array into a string, using the specified separator between each item. - Array
- Separator
Get List Length Returns the number of items in an array. - Array
Merge Lists Merges two or more arrays into one. - Array
- Array
If List Contains Checks if an array contains a specified value. - Array
- Value
Remove From List Removes specified values from an array. Effective only on arrays of primitive text or numbers. - Array
- Value
Add To List Adds specified values to an array and returns the updated array. - Array
- Value
Get First List Item Returns the first element of an array. - Array
Get Last List Item Returns the last element of an array. - Array
Reverse List Reverses the order of elements in an array and returns the reversed array. - Array
Shuffle List Randomly reorders the elements of an array. - Array
Flatten List Concatenates all sub-array elements into a single array. The "key" argument specifies which properties to flatten. - Array
- Key
Distinct List Removes duplicate values from an array. Use the "key" argument to specify properties in complex objects. - Array
- Key
Slice List Returns a new array containing only selected items. The "start" position is inclusive, "end" is exclusive. The first element has the position of 0. - Array
- Start
- End
Sort List Sorts the values of an array. Use the "key" argument to specify properties in complex objects. - Array
- Order
- Key
Object Keys To List Returns an array containing the properties of a given object. - Object

Date Operations

Operation Description Arguments
Now Returns the current Unix timestamp in milliseconds since January 1, 1970 GMT. No arguments
Set Seconds Sets the seconds in a date to a specified value. Accepts numbers from 0 to 59. - Date/Time
- Seconds (0-59)
Get Seconds Returns the seconds from a specified date. - Date/Time
Add Seconds Adds a specified number of seconds to a date. To subtract, enter a negative number. - Date/Time
- Seconds (0-59)
Set Minutes Sets the minutes in a date to a specified value. Accepts numbers from 0 to 59. - Date/Time
- Minutes (0-59)
Get Minutes Returns the minutes from a specified date. - Date/Time
Add Minutes Adds a specified number of minutes to a date. To subtract, enter a negative number. - Date/Time
- Minutes (0-59)
Set Hour Sets the hour in a date to a specified value. Accepts numbers from 0 to 23. - Date/Time
- Hour (0-23)
Get Hour Returns the hours from a specified date. - Date/Time
Add Hours Adds a specified number of hours to a date. To subtract, enter a negative number. - Date/Time
- Hours
Set Day of Month Sets the day of the month in a date to a specified value. Accepts numbers from 1 to 31. - Date
- Day (1-31)
Get Day of Month Returns the day of the month from a specified date. - Date
Set Day of Year Sets the day of the year in a date to a specified value. Accepts numbers from 1 to 365. - Date
- Day (1-365)
Get Day of Year Returns the day of the year from a specified date. - Date
Get Day of Week as Number Returns the day of the week as a number from a specified date. - Date
Add Days Adds a specified number of days to a date. To subtract days, enter a negative number. - Date
- Days
Set Month Sets the month in a date to a specified value. Accepts numbers from 1 to 12. - Date
- Month (1-12)
Get Month Returns the month from a specified date. - Date
Add Months Adds a specified number of months to a date. To subtract months, enter a negative number. - Date
- Months
Set Year Sets the year in a date to a specified value. - Date
- Year
Get Year Returns the year from a specified date. - Date
Add Years Adds a specified number of years to a date. To subtract years, enter a negative number. - Date
- Years
Parse Date Parses a string and returns a date. - Date
- Format
Format Date Formats a date according to specified criteria. - Date
- Format

Math Operations

Operation Description Arguments
Subtract Subtracts one number from another. - Minuend
- Subtrahend
Divide Divides one number by another. - Dividend
- Divisor
Multiply Multiplies two numbers together. - Multiplier
- Multiplicand
Max Returns the largest number in a specified array or among individually entered numbers. - Number/Numbers
- Number/Numbers
Min Returns the smallest number in a specified array or among individually entered numbers. - Number/Numbers
- Number/Numbers
Sum Returns the sum of values in a specified array or among individually entered numbers. - Number/Numbers
- Number/Numbers
Round Up Rounds a number up to the nearest integer. - Number
Round Down Rounds a number down to the nearest integer. - Number
Round with Fraction Rounds a number to the nearest integer. - Number
Average Returns the average of the values in a specified array or among individually entered numbers. - Number/Numbers
- Number/Numbers
Parse Number Parses a string and returns a number. - Number
Format Number Formats a number according to specified criteria. - Number
- Decimal Points
- Decimal Separator
- Thousands Separator
Pi Returns the constant π. No arguments
Random Returns a random number between 0 and 1. No arguments

Text Operations

Operation Description Arguments
Lower Converts all characters in a text string to lowercase. - Text
Upper Converts all characters in a text string to uppercase. - Text
Trim Removes whitespace from the start and end of a text string. - Text
Capitalize Converts the first character of a text string to uppercase. - Text
Start Case Capitalizes the first letter of each word in a text string. - Text
Length Returns the length of a text string. - Text
Contains Checks if a text string contains a specified substring. - Text
- Search String
Substring Returns a portion of a text string between specified start and end positions. - Text
- Start
- End
Replace Replaces occurrences of a specified substring within a text string with another substring. - Text
- Search String
- Replacement string
Index Of Returns the position of the first occurrence of a specified substring within a text string. - Text
- Substring
- Start
Split Splits a text string into an array of substrings based on a specified separator. - Text
- Separator
- Keep Empty String
Unique Identifier Generates a RFC 4122 version 4 compliant unique identifier. No arguments
Decode URL Decodes a URL-encoded text string. - Text
Encode URL Encodes a text string to a URL-safe format. - Text
Text To Binary Converts a text string to a binary format. - Bytes
Binary To Text Converts binary data to a text string. - Bytes
To String Converts any value to a text string. - Value
md5 decode Calculates the MD5 hash of a text string. - Text
md5 encode Generates a text string from a given MD5 hash. - MD5
ascii Removes non-ASCII characters from a text string. - Text
- Remove Diacritics
base64 decode Decodes a Base64-encoded text string. - Text
base64 encode Encodes a text string in Base64 format. - Base64
Remove HTML tags Removes HTML tags from a text string. - Text
Escape HTML Tags Escapes HTML tags within a text string. - Text