community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Batch Macro to create Field Summary for each unique value in column

Asteroid

Hello,

 

I am trying to create my first Batch Macro and I'm striking out.

 

I want to generate a Field Summary for each unique value in a specified column.

 

I then want to write that Field Summary output to a .XLSX on my desktop.

 

How can I do that?

 

I've attached a sample workflow. I want to generate a Field Summary for each VENDOR_ID.

 

Would it work if I filtered on each VENDOR_ID in the Batch Macro?

 

Capture.PNG

Alteryx Certified Partner

Hi @dmccandless 


A couple of pointers that will hopefully help:

 

  • Your control parameter should be Vendor_ID (as this defines the groups that you want to pass through the macro)
  • For each run of the batch macro you will create a new results grid from the Field Summary tool and these will all be stacked (unioned) when all Vendor_IDs have been processed. You'll probably want to append a Vendor_ID column *after* the Field Summary runs but before the data is passed out of the macro so you can trace back which rows relate to which Vendor_ID.

 

Hope that's useful.

Highlighted
Alteryx Certified Partner

I went a step further and built out the workflow - let me know if this does the trick for you:

 

Screenshot 2019-07-11 at 16.46.17.pngScreenshot 2019-07-11 at 16.46.25.png

Alteryx Certified Partner
Alteryx Certified Partner

I've put something together that should achieve what you're looking for. I used a Field Info tool on the input data so each field name can be batched on (Control Parameter). Inside the batch macro, I used a Dynamic Select to only grab the field I'm interested in (redundant, but I like to be safe), then I use the Control Parameter again to update the selection in the Data Investigation tool. 

 

The Macro will batch through every field and output each field summary on a different sheet of the Excel file.  Check it out and let me know if it works for you. 

 

 

Asteroid

Jamie,

 

Thanks for the prompt help and 'going the extra mile for me.'

 

I took your solution and added it onto it a bit, just to output each vendor's field summary to a new tab in the same Excel file.

 

Capture.PNG

Asteroid

Charlie,

 

Thanks a ton. I wasn't going for a field summary for each field, but this is really powerful to have! Thanks

Asteroid

I'm adding my final workflow.

Labels