Alteryx Designer Desktop Discussions

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

Loop Filtering

mompermj
7 - Meteor

i'm trying to create a loop in my workflow so that i don't have to copy/paste my workflow 13 different times. I found another thread on 'batch macros' (thanks to a workflow provided by ) and thought that was what i needed to utilize (i shamelessly lifted the macro and tried to conform my data to it) ::edit i have since removed the batch macro since it wasn't what i needed::

 

I have a raw dataset that i need to have filtered 13 different times and saved out into 13 separate files based on the value in one particular column. i've simplified a sample of 100 records and attached it.

 

Ultimately i frequently have issues like this where i have a raw dataset and i need to be able to carve it up into smaller pieces to provide to specific internal customers. I'd rather not have to over-engineer the process by creating a piece of modern art in the workspace.

 

 

 

I did add a formula tool to insert a unique path based on the 'GROUP' and it did work; however, the filter didn't work and instead it included everything from all groups.

 

if i am approaching this in the wrong way let me know. i'd rather not have to do what i have been doing prior to this...Any help is greatly appreciated.

 

 

 

3 REPLIES 3
CharlieS
17 - Castor
17 - Castor

From what you described, it seems like you're on the right path. If all the fields are the same for each table then a Formula tool can write unique paths and an Output can use that field. 

 

In the pictured workflow, does each Select tool perform the same action? Could that just be one Select tool?

thllm
7 - Meteor

Your uploaded sample did not include your macro because it was not saved as a packaged workflow.

Instead of Save as, go Options-->Export Workfow to include your macro.

 

If you are filtering the data on the same columns across all your outputs and  just suffixing the code (ARVT, PUMS) to each file you don't need a batch macro. You just need to configure the output tool. It can be configured to write an output file for each code value.

 

If you're placing all these files in the same folder then in your Output tool at the bottom of the configuration pane just change the output to append the code as a suffix.

SKtDfvx8kB.png

 

If you have different path for each file. Then you can use one find replace tool which looks up the code's and appends the path you want for each file. You could also use a formula with a case/switch statement, but a Find Replace would be my preference in this case. Then set as follows.

 

Then in the output change the option to replace the path. 

GbRoWVBOLX.png

mompermj
7 - Meteor

I guess i was over complicating things. I tried using the 'Append suffix to File/Table Name' method and it worked like a charm except that it puts everything in individual tabs within a single file as opposed to multiple files. I suppose this is better than nothing.

 

I've used change entire path before (i did it in the picture i included) and while it will modify the path, it includes the entire raw extract instead of the filtered dataset...Based on your comments i experimented by adding the group to the file name itself and it appears to have done the trick.

 

I usually use the formula tool to create the 'path' datapoint:

 

"Z:\generic path\"+[Group]+"_tax.xlsx|||"+[Group]+"CITY"

 

Thanks for setting me on the right path.

 

 

Labels