Skip to main content
Best answer

issue passing variables to python

  • March 6, 2023
  • 4 replies
  • 398 views

Dan0nator

I have a zap that processes json data into a python script. when I assign the input data you can see that there are null values in the string. This is good and expected, but when it gets to the code the null values are removed. I have tried replacing the “,,” values with “,null,” but because the “,,” values are stripped out before the code runs this does not work. I think this is an issue with the code functions in zapier.

 

 

Best answer by Troy Tessalone

@Dan0nator

Try something like this…

 

Array with null values.

 

 

Formatter > Utilities > Line Items to Text

NOTE: Set a static value to join

 

Then you can handle the TEXT output how you want into the Code step.

 

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

4 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • March 6, 2023

Hi @Dan0nator 

Good question.

Try this workaround…

Use a Formatter > Utilities > Line Items to Text step first.

You can use that to combine arrays into 1.

e.g. [ARRAY1]|||[ARRAY2], which will handle the nulls.

Then you can pass that into the Code step and handle it better.


Dan0nator
  • Author
  • New
  • March 6, 2023
The input shows the blank leading fields
the output has removed it.

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • March 6, 2023

@Dan0nator

Try something like this…

 

Array with null values.

 

 

Formatter > Utilities > Line Items to Text

NOTE: Set a static value to join

 

Then you can handle the TEXT output how you want into the Code step.

 


Dan0nator
  • Author
  • New
  • March 6, 2023

@Troy Tessalone that did the trick. I added “value “ and in my python code im just doing text matching so that additional word did not impact the code so it is working fine now. Thanks for the help.