10-05-2020 02:49 PM
Hi,
What should I add to this to remove CR and LF while generating a text file using File Writer .
“Test/Hello_”+ Date.now().toLocaleDateString(‘{“format”:“MMM”}’).toUpperCase()+Date.now().toLocaleDateString(‘{“format”:“YYYY”}’)+“.txt”
10-07-2020 10:14 PM
Add mapper after csv formatter , change view of mapper from document to binary for both input and output view, in then use $content.replaceAll(’\r\n’, ‘’) syntax .Make target filed as $content, it will work.
10-08-2020 08:43 AM
Here is the error after ,making the changes you’ve suggested.
10-08-2020 05:32 PM
Don’t know whether you tried what happens if mapper is before formatter, if so what is the outcome?
10-11-2020 11:06 PM
@groverarena Ok, before mapper use binary to document and make encoding none. Then use the suggested syntax.Make sure input view of the mapper should be document and the content type should suggest as String then it should work.
10-13-2020 09:39 AM
@groverarena, I didn’t understand your question entirely.
Are you trying to remove all \r\n from the CSV Formatter output (which is the row delimiter and would bring all the rows into a single row for the file), or are you trying to remove all \r\n from only field data coming from the SQL output (while keeping row delimiters in place for a valid CSV file)?
If it is the latter case, you can add a mapper between the SQL Execute and CSV Formatter with the following configuration. This will check all the values coming out of SQL Execute, and replace \r\n with an empty string.