How to stop sending an Automator email distribution if the output file is empty.

    The Automator sends email distribution whether or not the output file contains any data.  Many client has asked how can we stop sending an email distribution if the output file des not have any row.  To stop sending email distribution when the output file is empty perform the following steps:

    1- You need to add a filter in the Monarch model.  Open your model in Monarch, create a calculated field, and name it RecCount.  Make sure the field is hidden (Pic #1).  In the formula tab enter the Recno() built-in function (Pic #2).  The RecNo return a numeric value for each row in the table data.


                                                                                Pic #1


                                                                                  Pic #2


    2- Create a filter which the RecCount=1, and name it RecCountGTZero (Pic #3).  Save your model.

                                                                                Pic #3

    3- Launch Automator, upload the revised model.  Open the existing project that uses the model in the project editor. On the Model & verification tab expand Model verifications.  Check the following filter produces at least one row.  Select the RecCountGTzero filter.  Make sure the Stop option is selected (pic #4 and 4a).  Commit the project.

                                                                               Pic #4

                                                                              Pic #4.1

    4- Create alerts.  The Automator v12.4+ can send alerts per process.  Add the SystemAlertProcessFailed and SystemAlertJobFailed alerts (Pic #5).  When the output file is empty the alert will be initiated.  If there is any row in the output file, an email distribution will be sent, and no alert will be initiated.

                                                                            Pic #5