Skip to main content
Solved

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


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

fmesafejde wrote:

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

View original
Did this help you find an answer to your question?

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+32
  • Influencer
  • Best Answer
  • August 5, 2022
fmesafejde wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings