Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Conditionally Sending an Email Using Rowcount

BradFolger
7 - Meteor

Hi - I'm trying to send alert emails from my workflow only when certain conditions are met. The conditions are simple: there needs to be at least one record in that lane of data. Please see my workflow below. Basically, after each of the two Unique tools, I only want to construct and send the downstream emails if the count of records coming out of each of those Uniques is 1 or greater. Any thoughts? I've tried summing by grouping on all fields, then doing a count distinct, then applying a filter before the container that is CountDistinct_Field >= 1. When I attached that to the Basic Table part of my email, it worked, but the photo and the Intro text both still showed and the email was sent. Any insights appreciated. Thanks!

 

Two lanes of my workflow. I want the emails within the containers to only be sent if the lane contains 1 or more records.Two lanes of my workflow. I want the emails within the containers to only be sent if the lane contains 1 or more records.

8 REPLIES 8
ivoller
12 - Quasar

Hi,

 

Can you append the Count variable to the data stream after the second Append Fields and then filter on it before the email tool?

 

Cheers,

Iain

ddiesel
13 - Pulsar
13 - Pulsar

@BradFolger How about using a Count Records then Test tool after your Unique tool?

 

Capture.PNG

 

With this setting, your workflow will error (and therefore stop) on this condition. I use this without a Block Until Done tool and don't have any issues but you might need one to make sure the test happens before the email is generated.

 

 

neilgallen
12 - Quasar

@bradfolger

 

I believe you can insert the filter immediately before your email tool. Assuming you have the countdistinct_field as an available field in your datastream, that would prevent the email from going out. 

 

If not, you may need to join the countdistinct_field back to your data after the vertical layout.

 

 

I use a similar approach to only send email records on certain days of the week.

BradFolger
7 - Meteor

@ddiesel Thank you very much for your guidance -- unfortunately, I don't want the workflow to fail on this condition, as this is only a warning as opposed to a show stopper.

neilgallen
12 - Quasar

@BradFolger If the filter is immediately before the email tool, the workflow will not fail based on this condition. The email tool will just not send any records as there is no incoming data.

 

I've attached a very simple workflow as an example. This will not error, but will send no email based on the filter.

BradFolger
7 - Meteor

@neilgallen Thanks, Neil. My previous response was related to the other offered solution -- I am going to try this out today and will let you know - thanks again!

BradFolger
7 - Meteor

@ivoller, thanks for your initial guidance. Below is what I wound up doing, for anyone with the same question. Basically, I added a count distinct of the rows, then appended it back to the result set, then used a formula just before the email tool to check for "count >= 1". Works well, thank you everyone for your input.

 

 alteryx_conditionalemail.png

ddiesel
13 - Pulsar
13 - Pulsar

Thanks for @BradFolger sharing the solution! This one is going in my back pocket.

Labels
Top Solution Authors