CSV Iterator - Fields with Quotes

When iterating through rows using the CSV iterator, if the value of a field/column contains double quotes the field is seeming skipped (quotes don’t start/end the value and there this isn’t a “quoted text” issue)…

TJ

Hi TJ

Could you please send me the file that you are having issues with?

I recently re-wrote the CSV Iterator action as it was previously a very simple implementation that did not comply to the CSV specification. Previously the CSV Iterator action was unable to handle quoted fields that spanned multiple lines and quoted fields that contained quotes or the delimiter value.

This removed the need for the user to specify whether the fields are quoted or not as this is now automatically detected and handled.

Regards,
Steve

Attached is a project and csv file. This was stripped from a larger script and you can see the issue in the first iteration (from the log) as you step through. Note the 4th field/column doesn’t get picked up (Epublication “content package”) - its like it doesn’t exist.

I also noticed something weird after I removed a lot of the other code and variables from the script to make this sample - the watch variables no longer work (even though they exist) and old/deleted variables are still listed in the selection list when choosing a watch variable…

TJCSV_Quote_Test.zip (4.239 KB)

Hi TJ

This CSV file is not valid. The description field contains quotes within the field but the field itself is not quoted and the quotes are not escaped.

So your description field is: Epublication “content package”

To be a valid CSV field it should be: “Epublication ““content package”””

This does not comply with CSV format description. Have a look at rule 5, 6 and 7 for the CSV format description: http://tools.ietf.org/html/rfc4180#section-2

After changing this in your CSV file and running the attached example the CSV Iterator action handled the file correctly.

As for the other issue, I will have a look into this and get back to you.

Regards,
Steve

Nuff said, Thanks (and sorry about the Rugby World Cup)… TJ

No problems, also it worth noting that your fields can contain the delimiter character as long as the field is quoted.

It’s ok. We’ll be back to redeem ourselves in a mere four years!

Regards,
Steve

Also, I was not able to reproduce the strange behaviour with the variables and the watch editor. If you have a set of steps that you are able to use to reproduce the issue with the latest Automise build could you please post them so that I can investigate this problem further.

Thanks,
Steve