• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tFilter Advanced Mode

#1 2012-06-04 11:31:11

Piero001
Member
Registered: 2012-05-07
Posts: 37

[resolved] tFilter Advanced Mode

Tags: [CSV file, java]

Hello community,

I have a problem with the tFilterRow component. I don't know how to give it the following command:


If "Vorgang" is "Cancel" than do not integrate "Betrag" of "Artikel" with the same "Nummer"

-> I just want to aggregate all "Artikel" which are not cancelled!

So Talend should filter the value of "Nummer" whos "Vorgang" is "Cancel".

Pls look at my screenshot. Do you know a JAVA code for this Command?

Regards,

Piero


Uploaded Images

Offline

#2 2012-06-04 11:58:09

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] tFilter Advanced Mode

Hi

You might create a job as the following images.

The first subjob will generate a csv file called "out.csv".
The second subjob inner join source file and out.csv in tMap.

Regards,
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

#3 2012-06-04 12:31:59

Piero001
Member
Registered: 2012-05-07
Posts: 37

Re: [resolved] tFilter Advanced Mode

Hi Pedro,

thank you very much for your help.
I think your job is very good. But i get a nullPointException because the out file has just the value "1" or nothing in the "Storno" column.

How do I handle that if Storno is set as Integer?

Regards,

Piero

Offline

#4 2012-06-05 03:39:34

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] tFilter Advanced Mode

Hi Piero

I'm sorry. I can't find a column called "Storno" in your example.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-06-05 10:44:12

Piero001
Member
Registered: 2012-05-07
Posts: 37

Re: [resolved] tFilter Advanced Mode

I'm sorry pedro, I meant the "Cancel" column

Offline

#6 2012-06-05 10:57:02

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] tFilter Advanced Mode

Hi

Why do you have to set Cancel as Integer?
If you set it as String, you can avoid NPE exception.

Regards,
Pedro


Only Paranoid Survive.

Offline

#7 2012-06-05 11:11:54

avdbrink
Member
Company: Conspect Consulting & ICT
Registered: 2010-11-08
Posts: 360
Website

Re: [resolved] tFilter Advanced Mode

Hi Piero,

I think there might be an easier way to solve your problem.

I've attached some screenshots that result in a correct result I suppose.

Hope it helps (again smile)

Best regards,
Arno


Uploaded Images

Offline

#8 2012-06-06 16:20:11

Piero001
Member
Registered: 2012-05-07
Posts: 37

Re: [resolved] tFilter Advanced Mode

Thank you a lot for your help, the community is great!

I thing we are on the right way but i have to explain the problem more detailed:

I just want to ignore each Numbers which have a "cancel" in Vorgang. Maybe it helps you when I say that number stands for receipt Number.

the job was created to calculate the earnings. It should recognize that a receipt is canceled and do not consider it in the calculation. I can't take for grant that "Cancel", if it occurs, is the last element of a single receipt because I don't know if the shema of the file which is ~3 Gbyte big is constantly equal. I also tried what pedro told me but using a pivot is very slow with big Files..

So now I'm searchin for an Expression, that sounds like this:

Filter the key attribut "row.Number" if "row.Vorgang" of the same Number equals to "Cancel"

Maybe you can help me.

Regards,

Piero

Offline

#9 2012-06-06 17:16:08

avdbrink
Member
Company: Conspect Consulting & ICT
Registered: 2010-11-08
Posts: 360
Website

Re: [resolved] tFilter Advanced Mode

Hi Piero,

I didnt't know the "Cancel" row could be anywhere in the sequence of rows, so I used the "Last" function in the first aggregation. I've changed the job a little now. It uses the List function on the Vorgang column, which creates a comma separated list of values occurring in the Vorgang column. In the Filter component all records containing Cancel in this Vorgang column will be filtered out again, now using a String.match method with (.*)Cancel(.*) as parameter.

See the attached screenshots for more info.

I suppose this should do the job.

Regards,
Arno


Uploaded Images

Offline

#10 2012-06-06 17:47:58

Piero001
Member
Registered: 2012-05-07
Posts: 37

Re: [resolved] tFilter Advanced Mode

Hey Arno, thank you very much for your answer.

I tried your idea but now it gives me an error log:

Warning:the operation 'list_object' for the output column 'Vorgang' can't be processed because of incompatible input and/or output types
Exception in component tAggregateRow_1_AGGOUT
java.lang.NumberFormatException


I set
Number as Integer, Vorgang as String and Betrag as BigDecimal. What did I wrong?

Regards, Piero

Offline

#11 2012-06-07 08:09:07

avdbrink
Member
Company: Conspect Consulting & ICT
Registered: 2010-11-08
Posts: 360
Website

Re: [resolved] tFilter Advanced Mode

Hi Piero,

I see where that's going wrong smile
You should configure the first tAggregateRow component to use "List" as function for outputcolumn Vorgang and not "List(object)".

Good luck!

Arno

Offline

#12 2012-06-11 11:00:06

Piero001
Member
Registered: 2012-05-07
Posts: 37

Re: [resolved] tFilter Advanced Mode

Thank you arno! This did help smile

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tFilter Advanced Mode

Board footer

Powered by FluxBB