Alteryx Designer Desktop Discussions

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

Tool to stop workflow stream if condition is not met

link7878
5 - Atom

Hi 

 

The issue I am running into, there are 0 records being sent down a specific steam within my workflow based on filter condition. Is there a way I can disable the downstream steps if a condition is not met.

 

 

4 REPLIES 4
SPetrie
12 - Quasar

If this is an app or macro, you can use action tools to disable containers or use detours to go around them when conditions are met.

If you are ok with a more nail/hammer type solution, use a text input tool to union "exit /B" as the last line of your cmd. 

If there are no records in the stream, it will still append the exit /B command which just tells the batch file to close.

cmd.PNG

rzdodson
12 - Quasar

Here are some helpful steps for you:

 

Initial Actions
1. Split your workflow up in to two distinct workflows: 1) your workflow all the way up to where we have 0 records outputting from a specific stream, 2) the workflow that is dependent on triggering that condition. Your second workflow will be set up as a macro.

2. Insert a Count Records tool as your last tool before we trigger the dependent workflow.

 

Dependent workflow

3. Containerize the dependent workflow in its own window.

4. Insert a Condition and Action tool into your second workflow. 

5. Update the Condition tool with the expression you are needing (re: Count=0)

6. Update your Action tool to "Enable/Disable Container from Condition".

7. Save the second workflow

 

Original workflow

8,. Connect the macro with the dependent workflow as the next tool following your Count Records tool.

 

Below is another thread that may help you out - similar use case where we have to conditionally perform actions based on whether we hit a specific record count:

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Conditionally-Sending-an-Email... 

link7878
5 - Atom

Hi SPetrie

 

Thanks for the quick response. I have appended exit/B command and It fixed my issue with cmd tools error when no records in the . How can I fix email tool error now.

 

SPetrie
12 - Quasar

Sorry, didnt notice that tool previously.

I think in that situation, it may be better to go with a macro or disabling container methods I and @rzdodson mentioned previously.

You can setup a macro with detours or to enable/disable containers depending on what you want done in situations.

I attached a small example of a workflow that uses a macro with detours to skip tools if there is a 0 record count.

macro.PNG

 

There are a few ways you can go about solving this. This is just one example. Hope this helps!

Labels