Jun 12, 2020 03:10 PM
Hi y’all,
I’m trying to use Zapier to perform an action on a comma separated string of records, where that string is variable in length. It could be four records long, it could contain no records. As you probably know, Zapier natively will not iteratively work through a list of records and perform the Zap’s step to each. Having the ability to perform the following steps on a list of records would be fantastic.
Alternatively, if I could break that string of records out into individual items, I could set up a complex series of filters and repeating steps, but I’m having trouble with that as well. In the past, I’ve used Zapier’s Text module to separate text into separate fields using [:space:] or [:return:]. However, when I try to use comma as a separator, I only get the string of records back as the output, not the individual records.
Go easy on me. I’m not much of a coder, and still a bit of an Airtable n00b. :slightly_smiling_face:
Jun 14, 2020 02:23 AM
You can do this with a code-step and a for loop.
Where inputData.lines would be as follows:
var lines = inputData.lines.split(',')
Then run a for loop for the length of lines:
for (var i = 0; i < lines.length; i++) {
***CODE COES HERE******
}
Jun 14, 2020 10:43 PM
Hey Adam,
You can try doing that with a Zapier alternative called Automateio.
I suggest you use its Formatter app to break that string of records with the ‘Split text’ operation in the app and use the comma separator. Then use the appropriate filter if necessary.
Brian :slightly_smiling_face:
Jun 15, 2020 08:17 AM
Thank you @andywingrave! I’ll play around with that. I figured out a solution, but it seems a little inelegant, so I’m going to keep tinkering.
Jun 15, 2020 08:25 AM
@Brian_Don, thank you for the recommendation. I actually figured out what I was doing wrong in Zapier:
Since my records were coming in as a string (e.g. [recXXXXXXXXXX, reXXXXXXXXXX, recXXXXXXXXXX]), I had to first convert them to text to split them out appropriately. That made each one individually usable in subsequent steps.
Then I used a series of filters–to stop unneeded operations–and repeated steps to affect each record appropriately. It seems a little bit clunky, but it got the job done.