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:
Solved! Go to Solution.
@Bobe Try connecting your macro to a browse tool.
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?
I've added this to the Alteryx Product Ideas board:
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.
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:
Calling the macro:
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").
painful burn this one
I was today's years old when I discovered this one 🤣
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.
User | Count |
---|---|
18 | |
14 | |
13 | |
9 | |
8 |