I have trouble to filter data in a job in talend TOS DI 6.2.1.
The purpose of the job is to load and transform an xml file containing one (or more) invoice. The first layers of the tree contain the header, then the deepest contain the invoice lines. Ex:
Everything worked well until I need to reject the whole invoice (not just the lines) if all of "fiscal_period" fields (invoice lines) of an invoice do not have the same value, Ex:
Invoice number = 12193624860002852
If line in field "fiscal_period" not equals to prévious "fiscal_period" then reject invoice and send this reject to a file.
Currently I have created a global variable and a tMemorizeRows that allows me to identify when the "fiscal_period" is different from "fiscal_period" previous line.
Then with a tjava_row I set the variable to true or false, finally with a t_filterrow I reject and send to Excel log errors file.
Problem is: the lines are rejected but not the entire invoice.
Does anyone have an idea for a solution?
PS: My Job looks like this:
as idea, may be not fasted, but it will work
1) make list of invoices in file (extract uniqueid from XML)
2) iterate over list - XML path for single uniqueid as TOP level
3) extract fiscal period from all parts -> make list unique -> count number
4) IF(runIf trigger) number more than 1 - reject
5) IF number = 1 - continue Job