Best answer

Delimit text / escape commas in text for Line Itemizer


Userlevel 1

Hi everyone

I am trying to figure out how to handle the situation where text fields passed through the line itemizer contain commas. I can strip them out at the source, but would sooner handle them elegantly if I can.

I’ve read all the documentation on the Formatter and Line Itemizer, and searched the community forum, but can’t see how to handle this.

I tried delimiting the text in quotes so the commas are enclosed in quotes, but the itemizer just inlcuded the quotes as part of the string and then split the string at the quote.

I looked for a way to escape the comma, but couldn’t find a way.

Can someone please advise?

Thanks

icon

Best answer by ikbelkirasan 8 July 2020, 12:13

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.

7 replies

Userlevel 7
Badge +11

@rsngt - Can you provide an example string (with and without the quotes) on which you would like to apply Line Itemizer? Thanks

Userlevel 1

Hi

 

Here is an example string with quotes. It’s the comma after “devices” that causes the issue, and the Line Itemizer splits it into two items on that comma.

 

“Garmin inReach Professional Plan - Basic 2 x demo devices, both currently on Basic plan Additional licenses cover period 04-JUL-2020 to 03-AUG-2020”

 

and without:

 

Garmin inReach Professional Plan - Basic 2 x demo devices, both currently on Basic plan Additional licenses cover period 04-JUL-2020 to 03-AUG-2020

I have this issue as well. Mapping incoming text to a text field that allows multiple inputs is splitting the text by commas resulting in additional fields in the array.

Userlevel 1

I am sure there must be a way to delimit the text, or escape the comma, but I just can’t find any details on how to do this in either the documentation or the community guide.

 

Any help would be greatly appreciated.

 

Thanks

Userlevel 7
Badge +11

Hi @akshay and @rsngt 

So, after further testing, it turns out there’s no way to escape the commas because they are used as a delimiter to split strings and turn them into line items. There’s a workaround though but it’s far from ideal. You could use an alternative comma character other than the regular comma. For example: 

For your reference, its Unicode value is U+201A

@ikbelkirasan yeah, this is most likely a bug in Zapier code though. As it is splitting the contained text within a field to make it line items even when they are clearly just part of a text content mapped to a single input field. The splitting based on any delimiter should not happen automatically. Only when the zap explicitly wants it to be split by using line item input field, etc.

 

Imagine a scenario where you are ingesting user generated content - survey answers for example. You create an input field that allows multiple instances. You’d map each response to its own input field instance. But on the API end you will get an arbitrary number of texts in an array. 

Thoughts?

Userlevel 1

@ikbelkirasan yeah, this is most likely a bug in Zapier code though. As it is splitting the contained text within a field to make it line items even when they are clearly just part of a text content mapped to a single input field. The splitting based on any delimiter should not happen automatically. Only when the zap explicitly wants it to be split by using line item input field, etc.

 

Imagine a scenario where you are ingesting user generated content - survey answers for example. You create an input field that allows multiple instances. You’d map each response to its own input field instance. But on the API end you will get an arbitrary number of texts in an array. 

Thoughts?

I agree 100%, there really should be a way to delimit the string content with quotes. This approach, even if optional, is pretty standard for any form of comma delimited processing, such as CSV files etc.