Redirect flow if no rows

  • Hi all ,

    In data flow, we have a Ole db source that uses a view to check a table for data.

    Upon success there's a Flat File Destination that dumps any rows found into a .csv.

    Upon success in Control Flow there's an Execute SQL task that fires off an SP to send an email.

    I'd like to reconfigure this so that email is sent only if there ARE any rows. Otherwise the package should end WITHOUT failure.

    Is a conditional split the way to go? If so/not how to configure?

    Cheers,

    JB

  • Use a RowCount transform in your Data Flow task just after your OLEDB Source component and store the result of the RowCount in a variable, scoped at the Package level.

    In your Control Task, set the Precedence Constraint between the Data Flow Task and the Send Email task to 'Expression and Constraint'. The Constraint should be set to Success and the Expression set to @RowCountVariable > 0.

    Regards

    Lempster

  • Worked great, thanks!!!

  • You're welcome. 🙂

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply