Modify an or bar | to a space in an input field

Four Stars

Modify an or bar | to a space in an input field

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?

Employee

Re: Modify an or bar | to a space in an input field

Hi,

 

   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.

 

Warm Regards,
Nikhil Thampi

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

 

 

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog