Skip to main content

I am trying to use Formatter to split a string of 6 test responses and have encountered the problem that if a test is not complete, the value is empty. So a typical response might be:

 

clear, clear, , ,clear, clear

I need the response to be:

0: clear
1: clear
2: 
3:
4: clear
5: clear

But instead I just get 1-4 = clear

Any ideas on how to solve for this within formatter, or is there a code alternative (am not really a coder!)

Hi @PeterCera 

Try using Formatter > Utilities > Text to Line Items: https://zapier.com/help/create/basics/use-line-items-in-zaps


Sadly @Troy Tessalone that just gives this:

 

output

1

   1 Clear

2

    1 Clear

3

    1 Clear

4

     1 Clear


@PeterCera 

I tried this:

 

And got this:

 


@PeterCera 

Or you can use a Javascript Code step like this;

 

 

 


Hi @Troy Tessalone this is great thanks, an works - but when I go to plug in a response into a google sheet update lower down the Zap, the field available to me from the code step still reads like an array of Result (Clear,clear,,clear,clear) - I can’t figure out how to, for example just extract the 5th item (“Clear”) which corresponds to the field I’m trying to populate. Thanks so much for your thoughts

 


@PeterCera 

Give this Javascript Code a try:

 

The code returns a Set object with each option as it’s own data point.