We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic Input With Condition

sanketkatoch05
8 - Asteroid

Hi,

I have been working on a workflow that has 5 inputs. The first 4 inputs are standard inputs and will be used in all scenarios but the last input cannot be used in some cases. I want this input to run on a condition. 

Condition: I have also used a Count Records tool to form the condition, that is, if the value in Count Records tool is 5 then only run the 5th input file else run the first 4 inputs only. 

 

Now, I'm stuck on how do I connect this condition with the (dynamic) input. 

 

 

11 REPLIES 11
jrgo
14 - Magnetar

Hi @sanketkatoch05 

 

I believe you'll have to create a batch macro. the value from your Count Records tool would feed into your control parameter. there's probably various ways to use the value from the CP, but best way - IMO - is to have it update a Detour tool.

 

Using a filter tool won't work because the Dynamic Input tool will still run. A Detour tool, however, completely disables tools that the data stream is detoured away from.

sanketkatoch05
8 - Asteroid

Hi @jrgo

 

I'm pretty much new to Alteryx. I'm not sure how to make a Batch Macro on a dynamic input file and likewise, I don't know how the Detour Tool works. 

Since the files that I'm working on are very confidential, so should I send a dummy workflow, so that I can get a better understanding?

 

jrgo
14 - Magnetar

Hi @sanketkatoch05 

 

Feel free to send some dummy data if you'd like, but I won't be able to put together a solution for you anytime soon, but someone else may be able to.

 

There's quite a bit of training videos available in Academy that reviews Macros and, more specifically, Batch Macros. The Detour tool is pretty straight forward and is used with the "Detour End" tool. If you click on a either (found in the Developer tool category), there is a tool example you can look at.

jrgo_0-1618932978924.png

 

sanketkatoch05
8 - Asteroid

Here you go. 

I'm attaching a dummy workflow with input files. 

 

PS: I'm not able to add zip files, hence I'm adding the files separately. 

 

 

sanketkatoch05
8 - Asteroid

Could add only 5 files in the last comment, here are the last 2 files. 

@jrgo, if you could help me in tagging some people you may know who could help me in this, since I was hoping for a solution at the earliest.

 

DylanDowrick
9 - Comet

I went with two batch macros. The first didn't pass the empty file through the first time, but it's a good check in case it ever does.

The Workflow: 

DylanDowrick_0-1618946349859.png

The directory is linked to a folder with those five files. 

 

The first Batch Macro: 

DylanDowrick_1-1618946393399.png

This essentially outputs a single record of FullFilePath and CountRecords. The Macro outputs a union of all five files in the original workflow.

 

The second Batch Macro: 

DylanDowrick_2-1618946466139.png

As straight forward as that gets where only files with record counts >0 are fed into it!

sanketkatoch05
8 - Asteroid

Hey, @DylanDowrick.

Thank you for replying, can you send me the workflow so that I can test it with more data?

 

Also, will this macro work with a Dynamic Input tool?

DylanDowrick
9 - Comet

You can relink these workflows to your files. You should be able to replace the second batch macro with the dynamic input tool but I've found that the batch macros help with schema issues if you ever have those.

DylanDowrick
9 - Comet

I went and added both so that you can have a look-see.

Labels
Top Solution Authors