Sometimes you need to modify the values. For example, you receive a percentage value but you'd like to store it in the decimal format (i.e. 75 becomes 0.75). This is exactly where Modifiers excel.
Modifiers are a powerful tool to modify variable values, change their format or even use conditionals and loops to structure the actual output of your variables. It's like applying excel formulas to your variables - but simpler.
Modifiers can be stacked, meaning that the result of one modifier is an input to another modifier used for the same variable (e.g. "divide by 10, then add 50, then round").
Let's dig deeper into what Modifiers are by continuing with our simple example. Say we collect a "Percentage" field in a form and pass the data to a Google Sheet. On the way, we want to adjust the percentage from 75 to 0.75. To achieve that, you can simply click on the variable and choose the right data modifier.
As you can see, the Modifiers dialog contains different categories for different types of variable values. In our case, we're interested in the "Number" category and the "Div" modifier that divides our Percent variable by another number that we specify. Just click the "Div" modifier to apply it to our variable and tell the modifier that we want to modify our value by 100.
Now press "Close" and you'll see the "Percent" variable changed appearance a little bit to tell you that it will be modified at runtime.
To explain the power of modifiers, let's look at the second example. This time, we'll want to modify dates. Imagine we keep a record of our employees' vacations and want to notify them by email and SMS two days before their vacation ends to remind them that they should come to work in two days. Our sheet can look like this:
Our "To Date" column contains the end date of the employee's vacation. However, we want to send them SMS and email two days before their first day at work. Therefore, we want to subtract one day from the "To Date" and wait for that new date to send them reminders. Our flow can look like this.
Notice how we use the "Wait" component to wait for a certain date. In the "Until" field, we use the modified "To Date" column value. We modified our variable with the "AddSpan" modifier from the "Date" category and filled "-1" for the "Days" parameter.
You might have noticed that there are many modifier categories and types at your disposal. We intend to give you maximal flexibility with our pre-built modifiers or empower you to simply build your categories and types.
Below, see the complete list of Modifier categories and types.
Each Loops over all values of a list or an object
JSON Path Accesses nested properties of the VALUE object using dot notation
Map Maps array to another array
Stringify Converts an object or list to a JSON string
Deduplicate
Filter unique values or objects in an array if property name is provided
Each Loops over all values of a list or an object
Filter Iterates over items in the list and returns a new list with values that pass the predicate
First Item Finds the first item of a list
Flatten Flattens array a single level deep or recursively
Initial Gets the first element(s) of an array
Join Joins items into a text
Last Item Finds the last item of a list
Length Finds length of a text or list
Map Maps array to another array
Max Computes the maximum value of array
Mean Finds average (arithmetic mean) of the values of array
Min Computes the minimum value of array
Nth Index Finds the nth item of a list
Pick Transforms the list by picking nested object values
Reverse Reverses array so that the first first element becomes the last, the second element becomes the second to last, and so on.
Shuffle
Shuffle values of an array
Stringify Converts an object or list to a JSON string
Sum Computes the sum of the values in array
Tail Gets all but the first element(s) of array
Add Adds two numbers or concatenate two strings
Base64
Generate base64 string
Camel Case Converts text to camel case. (Example: "Foo Bar"-> "fooBar")
Decode URL Decodes URL or a URL component
Encode URL Encodes URL or a URL component
Escape HTML Converts the characters "&", "<", ">", "", and """ in text to their corresponding HTML entities
Extract email addresses Returns a list of email addresses found in the text
Extract URLs Returns a list of email addresses found in the text
Extract words Splits the text into a list of its words
Kebab Case Converts text to kebab case. (Example: "Foo Bar" ->Â "foo-bar")
Greater than Tests if the first value ir greater than the second value
Length Finds length of a text or list
Less than Tests if the first value if less than the second value
Lower First Converts the first character of the text to lower case
Lowercase Transforms text to lower case
MD5 Gets an MD5 hash of the text
Padding Pads text on the left and right sides if it's shorter than a specified length
Regex Finds matches using regular expression
Replace Replaces part of the text using regular expressions or text patterns
SHA1
Hash a string using SHA1 algorithm
SHA256
Hash a string using SHA256 algorithm
SHA512
Hash a string using SHA512 algorithm
Snake Case Converts text to snake case. (Example: ""Foo Bar" -> "foo_bar")
Split Splits text by delimiter
Split By Whitespace Splits text into a list of words by chunks of whitespace
Trim Removes leading and trailing whitespace or specified characters from string
Trim End Removes trailing whitespace or specified characters from string
Trim Start Removes leading whitespace or specified characters from string
Truncate Truncates text if it's longer than the given maximum text length. The last characters of the truncated text are replaced with the omission which defaults to "..."
Upper First Converts the first character of the text to upper case
Uppercase Transforms text to upper case
Condition Conditional statement. If EXPRESSION evaluates to true, TRUE VALUE branch will be the resulting value. Otherwise, FALSE VALUE will be used.
Custom Fields
Returns flow custom fields
Equals Tests equality of two values. Resulting value is true if FIRST EXPRESSION equals SECOND EXPRESSION.
Flow ID
Returns current flow ID
Flow Name
Returns current flow name
Not Invert value. True value becomes false and vice versa.
UUID v4
Returns UUID v4
JavaScript Function Run JavaScript code to transform a variable value. Anonymous functions, arrow functions, and plain javascript code are supported.
Arrow function example:
Another example:
Add Adds two numbers or concatenate two strings
Avg Finds average (arithmetic mean) of a given number
Ceil Rounds to the smallest integer greater than or equal to a given number
Div Divides two numbers
Floor Rounds to the largest integer less or equal to a given number
Greater than Tests is the first value is greater than the second value
Less than Tests if the first value is less than the second value
Max Finds maximum of given numbers
Min Finds minimum of given numbers
Mod Finds remainder after division of one number by another
Mul Multiplies two numbers
Sub Subtracts two numbers
AddSpan Adds time span to the date
Format Date Formats a date/time string using a string of tokens
Greater than Tests if the first date is greater than the second date
Less than Tests if the first date is greater than the second date
Now (ISO 8601)
Returns current date string in the ISO 8601 format
Relative time Formats a relative date/time
Timestamp (Unix)
Returns Unix timestamp
PI
Returns value of PI
Random number
Returns a random number between 0 and 1
Appmixer is all about flexibility and agility. You can customise all modifiers and also implement your own using Node.js and upload them to the Appmixer engine via API to suit your specific business needs.
In the next section, you'll learn how to implement logic to your flows.