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

Batch Macro not looping after running the workflow as an analytic app

Vernon
7 - Meteor

I have a workflow that calls a batch macro to run through multiple store locations and exports an excel file with a sheet for each store (The sheet name is also controlled by the control paramter that is being fed in).

 

This works absolutely fine while running as a normal.

 

I decided to design it as an analytic app instead of a workflow, so that users can change the files (different months of the year) being fed in to generate the excel file.

 

Once I did that, the macro batch does not loop anymore.


The message I got from the App Results was "1 iterations were run (ended by a downstream tool)"

 

I did search up this error, it seems that users are missing a browse button in the workflow / output button in the macro. However, I have both buttons in my workflow.

 

If I switch back to running it as a workflow, it will work fine and generate an excel file with multiple tabs.

 

Wondering if anybody encountered this problem before or am I missing a setting so that it doesn't loop at all.

 

Thanks!

6 REPLIES 6
Claje
14 - Magnetar

Hi,


I'm making an assumption that the actions are all configured properly here.


I think the issue is that your macro has an output that isn't going anywhere.  As such, it stops running because it doesn't think the data is needed anywhere else.

If you try removing the Macro Output, what happens?

Vernon
7 - Meteor

Hi Claje,

 

Amazing! That actually worked! Thanks!

 

Can you help me understand tho, as to how how come when I ran it as a workflow, I can leave the output icon there and it will be fine, but once I run it as an analytic app, I have to remove the output button?

 

I figured it should be the same since running it as an analytic app is just asking me for inputs?

Claje
14 - Magnetar

So, since that worked - here is a layman's explanation of what is going on behind the scenes.


Since Alteryx has an engine that focuses on optimizing workflows, it builds out an execution plan each time it runs the workflow.  In doing so, it tries to improve performance wherever possible, cutting out things that aren't needed.  Another example of this is if you use a Sample tool immediately after an Input data tool and bring in only the first record, Alteryx will stop reading in records after that point, saving you from loading a bunch of extra data you weren't going to use anyway.


When you run your workflow in the Designer, since you have the browse tool connected to the Macro Output (and/or because browse anywhere is enabled), Alteryx will run all the way through to give you your full result set.  What changes when it is an application is that Browse tools are automatically disabled, which looks like it is changing your execution plan.  Because of this, Alteryx is looking at the workflow and saying "nothing uses this data after it is output", and stopping the execution early.


However, when there is no output, the macro is the end point, so it runs all the way through.


I hope this helps to clear things up, and that I did a decent job of explaining how I understand things like this to happen!

dataprep
8 - Asteroid

I up the topic. This behaviour is particulary dangerous.

 

Here my issue : I have a batch macro to drop table on my database. I use this macro on a workflow. 

 

If I run it on designer : all the lines are executed

If I run it on scheduler : only the first line is executed!!! 

 

This is the most dangerous and stupid way to optimize a wf. At least, the same behaviour is required between scheduler and designer.macro_1.pngmacro_2.png

 

 

@Alteryx : can we have at least an option to NOT have this behaviour?

IvanMtz
6 - Meteoroid

Best answer ever! :) thank you!

Labels
Top Solution Authors