Alteryx Designer

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

Following different paths depending on condition being met

Highlighted
7 - Meteor

Hi,

 

I'm new to Alteryx and I'm trying to do some data process automation in a workflow. Neither the tutorial, the community or search engine could provide the solution so time to ask in the forum.

 

In perspective of automating data generation process, I need to test for a condition. Depending on the case, one or other workflow should be executed. Is there a way to do that in Alteryx?

 

As in my specific example, I have a control file in text format that can contain either an one or a zero (it's being used as a semaphore). I'd like to check this file and if it is an one I'd like to run one workflow, else I'd like to run another (and this other one also has some conditions - like a chained if statement). So far the only solution I found was to use the TEST TOOL to see if the condition is true/false and then use events/Run after with/without errors, to execute one workflow or the other. However, this solution seems bad, not to mention clumsy in the case of many conditions.

 

What is the correct way to do that in Alteryx?

 

Thanks,

Nelson

Highlighted
7 - Meteor

The only way I can think to do this is to add a filter for the condition test, then add a macro for workflow 1 and 2 after the T/F outputs. This would then pass the data that you need through the workflows needed. 

 

Is this similar to what you were thinking?:

 Greenshot 2018-11-27 17.45.59.png

Highlighted
9 - Comet

@krysten's method will work great for most situations - just use a Filter tool to pass the data stream into one side or the other.

 

If you would like something more explicitly like control flow, you can check out using the Detour tool which is typically controlled using interface tools, so it requires wrapping the whole workflow into a macro.

 

 

Highlighted
7 - Meteor

Well, not exactly. I'd like a tool to check if it is 0 or 1 and depending on the selection, use different workflows with possibly different data inputs as well. If we have some kind of multiplexer tool in which it uses a control input to select which input data to use that would be perfect. Since it doesn't exist, I'm trying to get alternatives.

 

Kind of like this:

                                                                                  ____ Run Workflow1

                                                                                /

                                                                              /

ControlVariable(0,1,2) -------------------- SomeTool  --------- Run Workflow2

                                                                               \

                                                                                 \

                                                                                   \___ Delete a hardisk file

 

Something like this.

Highlighted
7 - Meteor

@nelsonwcf

why not create a batch macro to do this?

Highlighted
9 - Comet

Can you provide an example? It'd be easier to explain if we have a specific use case to work off of.

Highlighted
7 - Meteor

Just updated the answer with one example.

Highlighted
7 - Meteor

Which type of batch macro could do this? Batch macro, per my understanding, would only add iterations, not more paths of execution.

Highlighted
9 - Comet

Here's one example using a batch macro. 

Highlighted
7 - Meteor

Hi, 

 

It seems to work. Not very simple to implement, though. I will mark this as solved in any case.

 

That said, I'm disappointed with Alteryx, that it would require such complexity for something that is equivalent to an if statement.

 

Thanks!

 

Labels