If i set all the column types in the writer to text I get something that looks about right but with the spaces that are not delimiters changed to |
Hi,
for the reader, try
the PythonCreator solution I posted some time ago here.
It is, in certain particular scenarios, a bit more robust than the FME csv reader.
David
Hi,
Is there any particular reason for setting "no" to "Strip Quotes From Fields" on the CSV Reader? If yes, maybe solution will be different depending on the reason and actual data condition (there might be no solution).
If no, change it to "yes", and set "if_needed" to "Quote Output Values" on the CSV Writer. When the separator is set to "space" and also "Quote Ouput Value" is set to "no", the CSV Writer seems to replace every white space in attribute values with | (pipe) automatically to distinguish the separator character.
Takashi
The file is not really a csv file so not all text fields are enclosed within quotes so the easiest way to ensure quotes appear around the same fields in the writer is to keep them as part of the field.
In the end I decided it was easiest just to set everything to text then use a find and replace in Notepad++ to change the | back to spaces.
I think the StringReplacer with these settings can be used. Text to Find: ^"[^"]*"([^"]*)"[^"]*"$ Replacement Text: \\1 Use Regular Expressions: yes It will replace ""Mill Barn" Newboundmill Lane" with Mill Barn. If you specify "\\1" to Replacement Text, replaced string will be "Mill Barn" (quoted). When the attribute value doesn't match with the regular expression, it retains the original string (replacing will not be performed). Hope this helps.