Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Count of success and failed records

avatar
Explorer

I have a flow that processes CSVs and towards the end of processing I need to capture the success and failed records count in a SQL table

1 REPLY 1

avatar

@nuxeo-nifi  Wanted to first make some suggestions to help us better respond:

  1. Include a screen shot of your entire flow
  2. Include as much detail as possible about how certain parts are completed.  For example:  how is the CSV processed. 
  3. Indicate what you have tried or what you see "toward the end of processing" including details of what you expect.  For Example: a single update statement w/ fail and success counts,  or insert failures into 1 table and errors into another.

 

Not knowing this, we have to make some assumptions that could possibly result in providing an inaccurate solution or turn the post into long drawn out dialouge, versus simple question, and direct answer/solution.

 

Making those assumptions, I could assume at the bottom of your flow, you have a success and failure relationship.  One suggestion would be to use (MergeRecord/MergeContent) to obtain the counts, then maybe replaceText to fabricate the counts into correct shape flowfile and route to an ExecuteSQL processor to execute your SQL statements.   

 

Another alternative solution could be to send errors and success to separate ExecuteSQL processors in a way that for each flowfile it just executes a SQL statement that increments the existing count. This would save the need to merge and get totals.  Maybe like these in each ExecuteSQL:

UPDATE table SET success = success +1 WHERE tablename ='something'
UPDATE table SET errors = errors +1 WHERE tablename ='something'