Scheduled distribution only if it has data

SOLVED

If I create a scheduled distribution of a worksheet, how can I make it only deliver if it pulls data.  So for example I want to use this as essentially a notification for certain invoice types.  I have the work sheet built and filtered, and it's scheduled to go out daily with prior day data, but it's blank most days.  How do I get it to only send if it's not blank.

Parents Reply
  • 0 in reply to PatJones
    verified answer
    Hi Pat,

    You can add a condition in the job properties under the conditions tab. Your condition would basically be a count of records for yesterday's data and check if it's greater than 0. the condition would go against the process that is being used in the worksheet.

    For instance if you are looking at sales invoices and your worksheet/report only includes yesterday's invoices and only invoice type CRM then you can add the following condition. If the count(*) = 0 then it won't run the schedule.


    (
    select count(*)
    from myfolder.SINVOICE
    where SIVTYP_0 = 'CRM'
    and ACCDAT_0 = DATEADD(dd, DATEDIFF(dd, 0, GETDATE() -1),0)
    ) > 0
Children