Replace a string in Talend

One Star

Replace a string in Talend

Hi ,
I am having one complete line e.g 1|null|test.
I have to replace null with the ""(empty string) in Talend .
its a complete line and not a separate column.Because in our case its dynamic column content which are coming into one single column..?
Moderator

Re: Replace a string in Talend

Hi,
its a complete line and not a separate column.Because in our case its dynamic column content which are coming into one single column..?

That means you cannot use method
ReplaceAll(string s1, string s2)

in tMap?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Seventeen Stars

Re: Replace a string in Talend

I would use the replace method from String.replace
s = s.replace("null", "\"\"")
One Star

Re: Replace a string in Talend

Or even s.replace("null","")
Moderator

Re: Replace a string in Talend

Hi nikhilsh,
Is there any update for your issue?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Replace a string in Talend

yes thank you for your update .its working but i want the output as dynamic column again and not the string as
we are converting it the string for processing ..
Seven Stars

Re: Replace a string in Talend

Nikhil,
What is your output - file or database? support for dynamic schema will depend on that.
Thanks,
Nishad Joshi.
One Star

Re: Replace a string in Talend

its a file not the database.we are creating it as input for our external table
Seven Stars

Re: Replace a string in Talend

Then whatever you are saying is possible... you'll need more than one tMap to achieve this. Just make sure layout of the file does not change during transformation. One more thing, tSetDyanmicSchema component supports only positional file. For any other file type (Delimited, etc.), dynamic schema is your best bet.