Best answer

Formatter: Split Text not including blank values

  • 16 December 2021
  • 6 replies

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
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!)


Best answer by Troy Tessalone 17 December 2021, 16:49

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.

6 replies

Userlevel 7
Badge +14


Give this Javascript Code a try:


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


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


Userlevel 7
Badge +14


Or you can use a Javascript Code step like this;




Userlevel 7
Badge +14


I tried this:


And got this:


Sadly @Troy Tessalone that just gives this:




   1 Clear


    1 Clear


    1 Clear


     1 Clear

Userlevel 7
Badge +14

Hi @PeterCera 

Try using Formatter > Utilities > Text to Line Items: