Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
DrGenious
Creator

Replace to all columns

Hello,

 

I have a file with  16 columns. Most of these columns have special characters ^~. I want to erase these symbols from all columns but I dont want to go in every column and put replaceAll(). I want to find a way to apply this method (.replaceAll()) one time and catch all columns.

 

 

Thanks a lot.

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II

@DrGenious, as in the other example, use a tJavaRow:
tFileInputRaw --> tJavaRow --> tFileOutputRaw
Here is the expression you have to use:

output.content = input.content.replaceAll("\^~", ""); 

Other solution is good as you don't have read the file twice but if data contains the field separator character, it will not work as expected.

View solution in original post

6 Replies
TRF
Champion II

Read your input file with tFileInputRaw or tFileInputFullRow. It will give you every record as a single column in which you can go with String.replaceAll to operate the substitution. Then create a new output file and get this one to proceed with the rest of the job.
DrGenious
Creator
Author

@TRF 

Where I will put the String.replaceALL() ? 

CriticalMass
Contributor II

Hi,

 

you could just use tFileInputFullRow -- tJavaRow -- "someOutPut" like in the follwoing screenshot...of course you can do type conversions etc. in the Java Code.

 

0683p000009M8iO.png

DrGenious
Creator
Author

@CriticalMass  

Thanks a lot for your answer. The only wαy to achieve this is with array? 

TRF
Champion II

@DrGenious, as in the other example, use a tJavaRow:
tFileInputRaw --> tJavaRow --> tFileOutputRaw
Here is the expression you have to use:

output.content = input.content.replaceAll("\^~", ""); 

Other solution is good as you don't have read the file twice but if data contains the field separator character, it will not work as expected.

TRF
Champion II

@DrGenious, did this help?
If so, thanks to mark your case as solved (Kudos also accepted).