Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Looping through a list, creating a separate report for each value

DanielBye
5 - Atom

I'm new to Alteryx and I think this is a simple question, but I'm just not seeing any answers in the knowledge base or elsewhere on the community pages.

I have two files, one is a list of "Org ID". The other file contains data, and one of the columns in the data is Org ID.

I need to pull the data from the second file and append it to an excel template for each "ORG ID" value.

I'm just looking for a simple example on how I would best do this.

I've looked at iterative, and batch macros, but I'm just not sure how they work, or if they are overly complex for what I'm trying to do in this case.

By the way, this is just made up sample data, in reality I will be pulling from a Teradata database.

I've got that part figured out. I was able to pull all the data, and export it to Excel.

I just can't seem to figure out how to loop through my ORG ID list and create a separate report for the data for each ORG ID

 

Any help would be much appreciated.

6 REPLIES 6
CharlieS
17 - Castor
17 - Castor

There's a few ways you might produce separate reports depending on what you would like those reports to look like. Macros can be very helpful in processes like this (a batch macro would be appropriate here), but are not always necessary. 

 

I've attached a simple example that matches the Org_ID values from each input and outputs an Excel file with each Org_ID on its own sheet. This is achieved by the "Take File/Table Name From Field" feature of the Output tool. 

 

Let me know if this works for you, or if you're looking for something else in reporting. 

DanielBye
5 - Atom

Thanks CharlieS

The output needs to append to separate files, but I  think I can figure that part out.

This got me over the hurdle of separating them.

It definitely sounds like Batch Macros will be a great tool to learn, but this should work for now.

CharlieS
17 - Castor
17 - Castor

Excellent!

 

I've attached an example that shows how I like to construct the output path string in a Formula tool ahead of the Output. 

 

PS: If you'd like to accept a solution, the system is meant to mark the post(s) the solved the topic instead of your own. 😛

DanielBye
5 - Atom

CharlieS,

 

I thought I could figure out the Batch Macro, so I can put these in separate files for each ORG_ID.

I was wrong.

 

Could you please look at the attached, and point me in the right direction?

 

I think I'm just missing some key concept on configuring the Control Parameter tool, but I'm just not seeing it.

 

 

CharlieS
17 - Castor
17 - Castor

@DanielBye 

 

Since you have an external list of Org_ID values you'd like to batch on, use a Summarize tool to create a unique list of those values and that will be fed into the Control parameter for your batch macro. Inside the batch macro, use the Control Parameter tool to update a filter so only those records are processed. Then the Formula and Output tools are the same as before. 

 

Check out the attached workflow package for an example that includes this batch macro in action. 

DanielBye
5 - Atom

Just got a chance to get back to this today.

Yes, this will work.

Thank you.

Labels