cancel
Showing results for 
Search instead for 
Did you mean: 

Empty CSV File With Header Row

Schevus
New Contributor III

I have a need to write an “empty” CSV file that includes only the header row information in the case that there’s no data to populate the file. Does anyone know a good way to do this? Anything to do with the CSV formatter and the header row options doesn’t seem to be working out. It’s always writing a row of data with blanks for each element separated by the delimiter. Appreciate any thoughts, thanks.

7 REPLIES 7

ronmwhite
New Contributor II

I was just looking at this oddly enough. It is a simple POC I built for another team. The issue was that, sometimes, the object was not updated in Salesforce since the last run and returned null. So, uncheck “Ignore Empty Result” in the Salesforce Read, make sure the Mapper is Null Safe, and have the Router look for your key value. If it finds it, carry on as normal. If it does not, parse the object keys and write with the constant as I posted prior.

image

Schevus
New Contributor III

Mine looks a bit different. I left outer join my input stream with my static header row and evaluate for the presence of data in my router. Then I either remove the unnecessary header data element or map the header row data to the variable name expected downstream for the data, and union back together.

image

Schevus
New Contributor III

I have a lot of stuff going on downstream to also add a single column “end of file” footer row, which was also a real pain in the butt.