Lately, I’ve had quite a few people write in to support with very long Zaps where they are performing the same formatting step over and over, except on different fields. For instance, they might have 10 different names come in all at once, and they want to make sure each name is capitalized properly, so they have 10 different formatter steps, 1 for each name.
That might seem like the only answer, but there’s a much faster, easier, and task-saving way to do this! If you have 4 or more fields that you need to do the same formatting step on, then we can follow a workflow like this:
Convert all of those fields to Line Items → Perform the formatting on those line items once → Convert them back to text
This works because (almost) all of our formatters support line items, and will perform the same function on each item individually. So we can pass as many items to a formatter as we want, as long as they’re line items, and it will only take 3 tasks when the Zap runs.
I could spend a whole post just talking about line items, but for your sake and mine, I’ll refrain. Instead, let’s break down the above workflow into individual actions so you can implement it in your Zap too:
Step 1: Convert the fields to Line Items
Add a new Formatter step, and choose the Utilities action. Then for the Transform, choose “Text to Line Item”. This will give you a new field called Input.
For the Input, put in every field you want to convert separated by a comma - no spaces! It should end up looking something like this:
Test this step, and you’ll get a single set of “Line Items”, which we’ll use in the Formatter. If you’re not familiar with line items, it’s basically a special kind of data somewhat like single column in a spreadsheet - multiple fields all mashed into a single output called an Array. That’s not tremendously important to know to make this work though!
Step 2: Set up the Formatter
This one will look different depending on the kind of formatting you want to do. In my case, I’m capitalizing all of the names, but this can work with almost any formatter, including Spreadsheet-Style Formulas, Lookup Tables, Replace Text, etc. The possibilities are basically endless!
The one exception to this is the “Perform Math Operation” formatter - this does not work with line items. So if you wanted to do something like “Add 1 to each of these numbers”, you would need to use a Spreadsheet-Style formula instead. The “Perform Math Operation” formatter would just add all the numbers together and give you a single output.
With that single caveat in mind, here’s what my Formatter looked like:
As you can see, this is pretty simple. Just pass over the line items you created, and whatever the formatter is doing, it will do to each item in turn. In my case, the output looks like this:
So now each name is capitalized! If you have other formatters you want to apply to your data, go ahead and pass it through those while it is still in Line-Item format.
But to use this in most apps, we’ll need to break it back up into text, since line items are only supported in specific apps.
Step 3: Convert the line items back into text
This is pretty simple as well - add a new formatter, and choose Utilities → Line-Item to Text. Pass over the line items from the previous formatter as input. It should look something like this:
Test this out, and you’ll get all of these line items as individual text! Now you can map them into any other actions just like you would any other field.
I hope you find some use in this! If you come up with any cool or interested scenarios for this functionality, feel free to reply to this thread with your ideas.