Skip to main content

Using the Formatter string.length I count the length of a string then use that to evaluate a condition in a path. The problem is that the output of string.length is text and not a number. (What?!) This means using “greater than” or “less than” doesn’t work.

 

How do I convert this text into a number so I can actually make use of it?

Hi @pocaface 

Try using a Code step with the parseInt() function.

The parseInt() function parses a string and returns an integer.

Code: https://zapier.com/apps/code/help

parseInt(): https://www.w3schools.com/jsref/jsref_parseint.asp


@Troy Tessalone I guess I can spend time trying to figure out how to make that work. It’s frustrating that Zapier doesn’t just output it as length to begin with.


@pocaface

I tested and was not able to replicate your issue.

I successfully took the numeric output from the Formatter > Text > Length step and used the number value in a Filter step that had conditions of greater/less than.

Perhaps post screenshots of how your Zap steps are configured.


@Troy Tessalone Now that I go to test it again, the issue is no longer happening. I swear didn’t change anything other than hard reseting the page! The previous times I tested it, a length of 37 evaluated as both less than and greater than 255 🤷‍♂️.

Thanks for extending your IT aura to my situation.