Hi Jens, Joe

Thank you for your comments and the hint regarding the “CalculateRecordStats” 
processor – didn’t know that this even exists!

Jira Ticket https://issues.apache.org/jira/browse/NIFI-10996 has been created. 
Thanks in advance.

Cheers Josef


From: "Jens M. Kofoed" <[email protected]>
Reply to: "[email protected]" <[email protected]>
Date: Tuesday, 20 December 2022 at 09:38
To: "[email protected]" <[email protected]>
Subject: Re: CSV with header - but always, even for 0 record flowfiles

As a workarounds I have been using a CalculateRecordStats and a 
RouteOnAttribute to route files with 0 records and only fix those 0 records 
files so it doesn't influence all the correct files

Kind regards
Jens M. Kofoed


Den 19. dec. 2022 kl. 17.40 skrev Joe Witt 
<[email protected]<mailto:[email protected]>>:
Josef

Please file a JIRA with this information above. Makes sense what you're looking 
for.  Just not sure where this 'concern' would live whether it is in the 
processors themselves or the controller services for the writers.

Thanks

On Mon, Dec 19, 2022 at 9:21 AM 
<[email protected]<mailto:[email protected]>> wrote:
Hi guys

I’ve pretty basic question. We use a “ConvertRecord” processor where we convert 
an AVRO to a CSV. For that CSV output we would like to have the header enabled, 
so we tried to set “Include Header Line – true” for the Controller Service of 
the CSVRecordSetWriter. The issue is, if we have zero records, the header 
doesn’t show up (but it was there of course in the AVRO file). We need to have 
it as the columns are important for us, even if we have 0 records. At the 
moment we solve it with an extra ExecuteScript processor just before the 
ConvertRecord, there we add always an extra record with the header lines as 
string. But it feels a bit hacky as the record.count attribute is 1 record too 
high (due to the fake header record). Has anybody another easy approach :-)?

Cheers Josef


<image001.png>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to