Using Modifiers to alter data
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.
Using Modifiers to alter data
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.
Opening the Modifiers panel
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.
Using the "Div" modifier
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.
Saving the changes
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:
Record of our employees vacations
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.
Flow overview
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.
Using the modifier to adjust the date
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.
Object
List
Text
Control
Number
Date
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
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.
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
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
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.
Equals Tests equality of two values. Resulting value is true if FIRST EXPRESSION equals SECOND EXPRESSION.
Not Invert value. True value becomes false and vice versa. JavaScript Function Run JavaScript code to transform a variable value. Anonymous functions supported.
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
Relative time Formats a relative date/time
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.
Copy link