Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Loop, Iterate, Batch? Which is it?

rdphillips
6 - Meteoroid

Hey, 

I've been struggling to find a solution for a reporting process I have, and I think part of the issue is that I'm not sure what to search for, for the problem case. In something like VBA this would be a For Loop iterating across a defined array, but on these boards I'm not finding something along those lines.

 

I've attached an abbreviated mock-up of what I'm currently doing and what I'm looking for in theory. I believe I need to make one or more macros, but do not know which macro videos I should focus on to accomplish my reporting tasks.

 

I have a file with numerous clients (40+), I perform reporting for 10, the files have much much more data than what I've provided in the mock-ups - the crux is doing something by reporting client and repeating for each. I can build out the operations needed, but I cannot figure out how to take a list of reporting clients and Loop through those repeating the operations and exporting. I need to loop through a set of operations that are very similar for each client. So, I'm imagining that For Loop, for client 1 go through the operations, export to the appropriate location; loop back and repeat for client 2; loop back and repeat for client 4; etc. etc.

 

Which macro or other Academy videos would be helpful in order to create this type of workflow?

Thank you.

2 REPLIES 2
danilang
19 - Altair
19 - Altair

Hi @rdphillips 

 

The general rule is if the underlying problem can be solved with a For loop, i.e. you know the number of iterations before starting the loop, then use a batch macro and pass the loop variable as the control parameter.  If the issue can be solved only with a While loop, i.e. the terminating condition is not known before entering the loop, use an iterative macro and build the terminating logic into the macro logic. 

 

This is assuming you need a macro at all.  Your situation looks like it could solved without a macro by grouping as required by [Client ID].  Use a formula tool to build the output file path with something like "//Lan/"+tostring([Client ID])+"/reporting".  In your final Output Data tool, use the file path to modify the output location.

 

Dan 

 

 

binuacs
20 - Arcturus

@rdphillips one option to specify your path in the formula tool and configure the output tool with this path, you need to the folder with the name of the client id before running the workflow

image.png

 

 

Labels