Best answer

Filter CSV rows out depending on the value of a field

  • 9 March 2020
  • 2 replies

Userlevel 1

I have a Zap where I import a CSV and then later down the line I want to filter out some rows depending on the values within that row.

Example CSV:





In this CSV, I only want to proceed with people who are tagged as red. I tried to accomplish this using the "Run JavaScript" app, but even though I return an array of data, it seems to only return 1 row. Does anyone know how to do this? Thanks.


Best answer by druppe 9 March 2020, 18:25

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 1

When a Code step returns an array of data, it's interpreted as multiple instances of single rows of data -- your subsequent steps in the Zap will trigger on each row individually, and in the preview, you're only seeing the first row. It can be very useful, but probably not what you want in this case.

You should be able to have your code step return a single object containing an array, like

return {data: your_filtered_csv_data};

Userlevel 1

I think this did the trick! I am working on some other issues with my Zap, but this part seems to be fixed! Thanks!