Hi,

During file processing i am getting multiple records for a Customer ID for
multiple items purchased by him.
Each row has a Bill Amount which is actual value of items purchased by him. 
It also has an Customer_item_cost which is the cost of the particular Item
which customer paid.
It also has actual value of item under ActualCost column

Pass status is when (Bill AMT == Sum of ALL Customer_item_cost for a
Customer) and Bill AMT - (Sum of ActualCost of all items) = 0


What I am trying to do is to read the file record by record. Where the
difference is 0 i take it as a PASS and write it to a output file. Records
where i get FAIL, I want to hold the object in memory Map<String,
List&lt;Customer>>. Once the file is read than i want to take the object in
memory and do a calculation considering aggregation and append the result in
existing output file.

Currently I am facing problem where aggregation is not working properly.
Every fail Exchange has a Map object but it has only one record which is the
fail record itself.


Is there a better way of handling this scenario?

File Format:
--------------------------------------------------------------------------------------
CID, BillAmt, ActualCost, Item, Customer_item_cost
--------------------------------------------------------------------------------------
U123454, $100, $10, choclate, $10
U123454, $100, $90, Toy, $90

U123470, $200, $200, Dining Table, $200

U123474, $80, $100, Cycle, $80

Output:
--------------------------------------------------------------------------------------
CID, BillAmt, ActualCost, Item, Customer_item_cost, aggr_spend, Status
-------------------------------------------------------------------------------------
U123454, $100, $10, choclate, $10, $100, Pass
U123454, $100, $90, Toy, $90,$100, Pass

U123470, $200, $200, Dining Table, $200, $200, PAss

U123474, $80, $100, Cycle, $80, $80, Fail

Thanks
Sumit




--
View this message in context: 
http://camel.465427.n5.nabble.com/File-Processing-Aggregating-data-across-multiple-rows-tp5780270.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to