Jitterbit: target CSV-file created with only header although "do not create emtpy files" is checked

206 Views Asked by At

In Jitterbit Dataloader 10.37 I want to create CSV-files from Salesforce data but only if the query returns data. I checked "do not create empty files" on the target type local file but it is still creating a csv just with the header but with no data. I do not want files created with no data in it. It is not an option to not have the header at all in the files - I will need it when there is data from the query.

Any suggestions? What am I missing?

2

There are 2 best solutions below

0
On

I've seen this happen in situations where the write operation is after a couple of other operations. In that instance a header is written in the first operation, then another header is written in a second operation. The first row is read as the header, the second row (another header) is read as data, and written out.

I always add in a condition where I check if one of the fields equals its name. Something like this, to just skip those rows.

<trans>
  if(Id=="Id",
    false;,
    true;
  );
</trans>
0
On

The best way to do this is to send your output to a variable array. Then check the variable to see if data is present. So set your target to a global variable. Then add a script after that target and do your validation. To test your script use DEBUGBREAK(); to test and look at your variable content. That way you can see what is going into it. Then make your condition statement. if( Length($varailbe)>1,RunOperation("operation:myexport"),"novalue"):