Skip to main content
Solved

Add double quotes " " to text string and replace coma with pipes delimiter in CSV File

  • August 4, 2022
  • 4 replies
  • 823 views

Forum|alt.badge.img+1

See below my Workspace to generate a CSV file from a SQL View:

Forum1The CSV looks good except I need to put double quotes (“ “) for certain text strings. For example under Ledger Type column, AA should be ‘AA’.

Forum2Please let me know which of the String Function(s) in AttributeManager I should use to put double quotes around text strings (or other Transformer you deem more efficient):

Forum3Also, how can I replace all the comma separators in the CSV file with pipes character ’|’ instead.

Many thanks!

Best answer by ebygomm

Worked like a charm @Mark Stoakes​ 

One thing though.. somehow the CSV file format adds additional 2 more pair of double quotes to the text string even though i only defined as one pair of double quotes:

Forum5Forum4Believe it is more of a CSV file issue. Is there any workaround to only show one single pair of double quotes?

I suspect you've got qualify field values set to "As needed", values with quotes will then get additional quotes added.

If you change this value to "No" you won't get the additional quotes

image

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img+2

@fmesafejde​ There isn't a string function to add quotes. Just use the text editor to add the quotes:

"@Value(Ledger Type)"

You can set the delimiter on the CSV writer parameters when you add the writer to your workspace: Delimiter Character: |


Forum|alt.badge.img+1
  • Author
  • August 4, 2022

Worked like a charm @Mark Stoakes​ 

One thing though.. somehow the CSV file format adds additional 2 more pair of double quotes to the text string even though i only defined as one pair of double quotes:

Forum5Forum4Believe it is more of a CSV file issue. Is there any workaround to only show one single pair of double quotes?


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • August 5, 2022

Worked like a charm @Mark Stoakes​ 

One thing though.. somehow the CSV file format adds additional 2 more pair of double quotes to the text string even though i only defined as one pair of double quotes:

Forum5Forum4Believe it is more of a CSV file issue. Is there any workaround to only show one single pair of double quotes?

I suspect you've got qualify field values set to "As needed", values with quotes will then get additional quotes added.

If you change this value to "No" you won't get the additional quotes

image


Forum|alt.badge.img+1
  • Author
  • August 5, 2022

@ebygomm​  Thank you that worked!