We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Iterative or Batch Macro Help

Mike_at_CG
8 - Asteroid

Hi Alteryx Community

 

Is there a way to send the below workflow into the beginning of an iterative or batch macro?

 

I've attached a screenshot with the workflow prior to the macro part and then a 2nd attachment with the macro input put onto the canvas.  It almost seems like input macro tool is a starting point when in reality the select tool is the starting point before the macro input.

 

Thank you for any help you can provide as I have never created a macro before.  Obviously! :)

17 REPLIES 17
davidskaife
14 - Magnetar

Hi @Mike_at_CG 

 

I would take some time to go through the Interactive Lessons on Macros, especially if you've never done them before - https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Macros

 

Essentially you build a Macro as a separate workflow, which you then insert into the main workflow as a stand-alone tool.

 

There are also tutorials within Alteryx that focus on an intro to Macros, these are available under the Help menu.

 

Mike_at_CG
8 - Asteroid

@davidskaife  - Thank you for this.  At this point maybe I dont even know the question I am trying to ask.  

 

I am trying to create a workflow or macro within a workflow that does the below

 

1. Grabs header row and first row of data (this would be dynamic and could be 1 row or 10+)

2. Does a crosstab of those two total rows

3. Makes two columns using those to rows

4. Saves that data off in its own workbook

5. Repeats until no rows of data are left

 

Again, thank your for your help and your time

davidskaife
14 - Magnetar

Hi @Mike_at_CG 

 

Consider a Macro to basically be a 'tool' that you use to package repeatable tasks throughout your workflow (Standard Macro), or process records in a sequence (Batch), or run through data until nothing is left to process (Iterative). 

 

On first reading of your requirements I'd say you don't need a Macro, unless you're wanting to repeat the process detailed at multiple points throughout. In which case a Standard Macro would be worth considering. When you say 'repeats until no rows of data are left' what do you mean? You state that the header and first row would be dynamic, is the idea that it would process 1 row and output, then next row and output etc (but it could be 10 rows and output, then next 10 and so forth)

 

 

Mike_at_CG
8 - Asteroid

@davidskaife  - Below is a sample workflow that I currently have using some dummy data

 

Data After Dynamic Input Data After Crosstab Data After Make Columns
Step 1 Step 2 Step 3
DateContractsPriceCommission Date3/1/2025 Date3/1/2025Date3/2/2025
3/1/20251 $  85.00 $         150.00 Contracts1 Contracts1Contracts2
3/2/20252 $  95.00 $         250.00 Price $    85.00 Price $    85.00Price $    95.00
     Commission $  150.00 Commission $  150.00Commission $  250.00
     Date3/2/2025     
     Contracts2     
     Price $    95.00     
     Commission $  250.00     

 

My requirement does not allow for me to have the records next to each other in step 3 so my thought was take the row header and first row of raw data and make it look like the below and save off in its own file

 

Data After Dynamic Input Data After Crosstab Save as Contract #1
Step 1 Step 2 Step 3 
DateContractsPriceCommission Date3/1/2025 Date3/1/2025
3/1/20251 $  85.00 $         150.00 Contracts1 Contracts1
3/2/20252 $  95.00 $         250.00 Price $   85.00 Price $                   85.00
     Commission$150.00 Commission $                 150.00

 

And then move onto the 2nd row of raw data along with the column header and make the 2nd file.

Data After Dynamic Input Data After Crosstab Save as Contract #2
Step 1 Step 2 Step 3 
DateContractsPriceCommission Date3/2/2025 Date3/2/2025
3/1/20251 $  85.00 $         150.00 Contracts2 Contracts2
3/2/20252 $  95.00 $         250.00 Price $    95.00 Price $                   95.00
     Commission $  250.00 Commission $                 250.00

 

I thought a macro would be required as each row would need to be crosstab separately and then saved off in a file.  However, I am not sure how I would process that part either.

 

Thank you

davidskaife
14 - Magnetar

Hi @Mike_at_CG 

 

What is your final expected output? Do you need Contract 1 in a file, Contract 2 in a file and so forth?

Mike_at_CG
8 - Asteroid

@davidskaife  - yeah that is exactly right.  Contract 1 and 2 in separate files after they have been put through the crosstab tool.  Doing it all together would put the contracts side by side.

davidskaife
14 - Magnetar

Hi @Mike_at_CG 

 

A Batch Macro works for you, i've attached a package which contains a simple workflow, and the macro i've built. I'd encourage you to go through it and gain a good understanding of what it is doing/how it is working:

 

Macro - this is generating the filename based on the Contract, you can of course change this to whatever you want

Capture.PNG

Workflow

Capture2.PNG

 

Mike_at_CG
8 - Asteroid

@davidskaife  - Yeah I think this is exactly what I need.  

 

The only problem I am running into is amending the output to something on my own desktop.  I am using the below

 

C:\Users\myname\OneDrive - Company\Desktop\

 

But when I run the workflow with the amended location it will still reference what came over on your example

 

ErrorLink: Batch Macro (5): https://community.alteryx.com/t5/*/*/ta-p/724327?utm_source=designer&utm_medium=resultsgrid|Record #1: Tool #8: Cannot access the folder C:\Users\David.Skaife\Downloads.

 

I completely get that this is your desktop I just am lost on how I change to mine.

davidskaife
14 - Magnetar

@Mike_at_CG 

 

I forgot to change it! Open the Macro, in the Output tool at the top where you enter in the file path change that to yours, save and go back into the workflow and it should update automatically

Labels
Top Solution Authors