Using Modifiers to alter data
Last updated
Last updated
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
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.