I have an input file where our field separator is an or bar and there is a text field where people can enter anything in. I want to modify any or bar | entries to a space in that field so we do not have a conflict.
I've tried in tMap:
row11.Notes.replaceAll("|", " ") - gives a null pointer exception
row11.Notes.replaceAll("\|", " ") - compilation error
row11.Notes.replaceAll("\\|", " ") - gives a null pointer exception
Is there a way to do this in tMap or is it some other way that I need to address this?
Since you are reading the data to various columns based on delimited pipe character, you need to do the data parsing before reading the file. Else any pipe symbol inside the delimited file will be considered as a column delimiter.
The most easy way to overcome this issue is to ask the source system to add text enclosure character to your input file. In this way, any data inside text enclosure characters will be considered as part of data. This data can be replaced later using replaceAll function.
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Read about some useful Context Variable ideas