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 only iterates one time (expecting >1 iteration)

Bobe
7 - Meteor

Created my first batch macro. Its designed to read in .xlsx files with different schema, as several of the other solutions already published didn't quite meet my needs.

 

 

After building it out there's an issue: the macro only iterates once and returns a single row of data: 

 

problem.PNG

 

 

 

9 REPLIES 9
patrick_digan
17 - Castor
17 - Castor

@Bobe Try connecting your macro to a browse tool.

Bobe
7 - Meteor

Thanks, @patrick_digan

 

Turns out there's nothing wrong with my macro, just a subtle feature that's likely due to how Alteryx has been improved over time. Since I'm new to Alteryx, I didn't have the appropriate context. 

 

 

When Alteryx first came out, apparently there weren't a lot of output anchors for users to click on and quickly view their data. Instead, users would have to use a LOT more browse tools throughout their workflows. Batch macros still somewhat exemplify this behavior. As a result, if you don't have any tools connected to your macro output, it doesn't know how many iterations to run or where to stop. Instead, it just runs a single iteration and returns a single row as a test. If you connect a single tool to the macro output, this is resolved (see below). Wonder if macros still need to perform this way or if they would be able to output results in the output anchor like all other tools? 

 

Solution.PNG

 

patrick_digan
17 - Castor
17 - Castor
I agree with you. I've been burned by this before. When they added the browse everywhere feature in 10.0 like you're referencing, batch macros are one (the only?) exception where a browse or connected tool would still be necessary.
Bobe
7 - Meteor
aclaxton
8 - Asteroid

This has been driving me crazy for a few weeks. 

 

As someone who started using Alteryx after the browse everywhere feature was added I didn't even realize that was why my macro sometimes worked as intended. @patrick_digan you're a life (read: sanity) saver.

 

 

troyfurnace
7 - Meteor

I ran into this with Python and Command cases, where the meat of what's occurring happens outside of Alteryx's jurisdiction, and it thinks it's done before it really is.

 

Adding a browse as suggested works, but only in Designer.  However, when posted to Gallery (which implicitly disables browses), once again, it would end the iterations early.  It really, really needs the output stream to be used.

 

Based on what I could find, the options were:

a) Generate dummy output to satisfy it (invites trampling or race condition)

b) Modify all contributing macros (several in overall process) to not have an output stream (rather not make two versions of each macro)

...neither desirable.

 

But I found a way to trick it.  I created a simple standard macro with an input stream (template = single column "Any Field"), a count records, and browse.

 

Placed on the output streams where I didn't want to do anything with the output, this was enough to trick it into still going.

 

Guts of the macro:

Guts of macroGuts of macro

 

Calling the macro:

Attaching to output stream I don't care aboutAttaching to output stream I don't care about

 

 

Someone more versed than me can tell me a more stripped down version of what I did that would still work (I ran out of fuse a long time ago and stopped at "working").

 

Ty25
7 - Meteor

painful burn this one

Samantha_Jayne
Alteryx
Alteryx

I was today's years old when I discovered this one 🤣

Samantha Clifton
Alteryx
#alteryxrocks

Hey everyone,

 

I was working on a batch macro as well and found out that simply adding a browse tool at the end won't work if you publish your workflow to the server gallery. While the browse tool allows your batch macro to run locally as you run it, once I posted my workflow to the gallery server I was back to getting this type of variation of the message. 

 

1 iterations were run - ended by a downstream tool

 

To fix this instead of using a browse tool on the outputs of the macro I had to change them to output data tools and create a message log, after that the batch macro processed all the iterations and ran one at a time then outputted the messages to an excel file I setup.

 

2024-02-21_11-07-25.png

Labels
Top Solution Authors