Hello, I need validate the files in my flow, only are valid the files that contains > 10 rows, it´s possible this validation whith apache NIFI?. The files are .txt and .data.
Use QueryRecord processor and define record reader/writer controller services
add new property in the processor as
select id,name from (select count(*) over() cnt,ff.* from FLOWFILE ff)c where cnt > 10
We are using subquery count(*) over() window function on flowfile content to get count of rows from the flowfile then in outer query we are filtering out cnt column and checking the cnt is greater than 10 or not.
I have attached my flow xml here use that as a reference and prepare your sql query as per your requirements.
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
sorry, missed that you need "greater than 10", so change regex to:
Note, it is "9" for ten records, because last line won't have \n (EOL)