One Star

How to use tfilterrow

Hi
I'm a new talend's user.
I have 1 excel file (input) and 1 excel file (out put) - very simple
I want to filter a column by numeric and by text.
For numeric, it's OK - it's ==
But, for the text filter, it's a real problem for me. I try to do a "like" because my text begin by "impaye.....". I want every line with "impaye..." begin.
I hope somebody understand me.
My english is too bad.
Thanks you
5 REPLIES
One Star

Re: How to use tfilterrow

Try a tFilter like this one....
One Star

Re: How to use tfilterrow

Thanks you
I did like your example by i have this error :
Starting job export_00 at 09:08 06/08/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method StartsWith(String) is undefined for the type String
at test.export_00_0_1.export_00.tFileInputExcel_1Process(export_00.java:2390)
at test.export_00_0_1.export_00.runJobInTOS(export_00.java:2978)
at test.export_00_0_1.export_00.main(export_00.java:2893)
Job export_00 ended at 09:08 06/08/2008.
One Star

Re: How to use tfilterrow

Why don't you try spelling it with a lower case "s" : startsWith instead of StartsWith ?
One Star

Re: How to use tfilterrow

Ok I changed Starts by starts. But, A new message error :
Starting job export_00 at 09:49 06/08/2008.
Exception in component tFilterRow_1
java.lang.NullPointerException
at test.export_00_0_1.export_00.tFileInputExcel_1Process(export_00.java:2390)
at test.export_00_0_1.export_00.runJobInTOS(export_00.java:2978)
at test.export_00_0_1.export_00.main(export_00.java:2893)
Job export_00 ended at 09:49 06/08/2008.
One Star

Re: How to use tfilterrow

It appears that some of the rows in your input data have an empty field (in the column that you're filtering). You can use a try catch to reject the rows in which the field is empty.
I would make a routine with the method startsWithImpaie(String).
It could be like this :
public static boolean startsWithImpaie(String field) {
try {
return field.startsWith("impaye");
}
catch ( NullPointerException npe ) { return false; }
}
And then call it in my tFilterRow like this :
routineName.startsWithImpaie(row1.Column5)