Ticket #31407
Question
I have a task that outputs a file to the server. The task uses a Distribution List Retrieval to pass a value to a runtime filter in the report. The value being filtered on in the report is customer number. What I want is that if only there are records in the report for the customer to output a file to the server. I currently have files being created for all customers with no records. Any ideas on how to accomplish this?
Answer
This is possible, but the key is that you need to get the Distribution List filtered down to exclude customers who do not have any records in the report. This way when the task is ran, the only emails found in the Distribution List are those customers who have data.  Based on your setup, what I would suggest is in the Distribution List Retrieval creating an additional column (or a calculation) that can look up if a customer has any records associated with them in the data table that report is using. I feel confident a subquery calculation could probably accomplish this with ease. Basically just have the calculation query the table of the report to do a count of the records for the customer. If the returned count is greater than 0, the calculation expression will be 'Y' and when the returned count is 0, the calculation expression will be 'N'.  Then pass this flag as a parameter to the Distribution List in the task message OR create a Filter in the Distribution List retrieval for CALCULA001 equal to 'Y'. 
Asked on April 30, 2021