Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Batch Macro to Ouput Files Based on Parameter(s)

Bonediggler
9 - Comet

Experts - 

 

I essentially need a macro that does the following: 

 

1) Output .yxdb files to locations specified by a strings I pass the macro

2) The number of iterations should correspond to the number of strings that are passed

 

For example, if I pass the string "\folder1.yxdb" the macro will output the data to this location.  If I pass the strings "\folder1\data.yxdb" and "\folder1\ARCHIVE\data.yxdb" the macro will iterate twice, outputting the same data to each location.  

 

Is this possible?

 

Thank you!

6 REPLIES 6
BrandonB
Alteryx
Alteryx

I think that you are most likely going to be leveraging the Take File Name from Field option in the bottom of the Output Data tool configuration. This can change the name of the file that is written based on the values that exist in a column. 

If you wanted to perform this process for multiple file names, you could put the output tool into its own macro.  You would use a macro input (interface tool) connected to a formula tool connected to the output data tool, and then a control parameter with action tool connected to the formula tool. The formula tool would be used to create the file path passed in by the strings that you specify. That way when you have it in your main workflow, the macro will run one time for each file path string that you want to use that is passed in to the control parameter. Also, this would be a batch macro rather than an iterative macro, because it will only process the number of times control parameter values are passed in rather than an iteration process. It is possible to set up an iterative macro in a similar way but it would require more steps and this is the most straightforward method. 

WilliamR
Alteryx
Alteryx

Hi @Bonediggler ,

here is an example of a batch macro taking the path as parameter.

The action tool from the macro just replace the directory of the file using the option at the bottom.

 

WilliamR_0-1577183296392.png

 

Here is the main workflow. There is one iteration per line in the text input tool.

 

WilliamR_1-1577183323926.png

 

(If this post helps, then please consider it as the solution to help the other members find it more quickly).

 

Bonediggler
9 - Comet

Thanks William!

 

Is there any way you can output this in a prior version of Alteryx?  I can't open it.  

 

My version is: 2018.2.6.51223.

benakesh
12 - Quasar

Hi @Bonediggler ,

You can open the wf and macro in  notepad and  change the version  to 2018.2  and save .

ex  :   yxmdVer="2019.3"   to  yxmdVer="2018.2" 

WilliamR
Alteryx
Alteryx

@Bonediggler ,

this package is for a 2018.2 version.

 

(If this post helps, then please consider it as the solution to help the other members find it more quickly).

omkarshinde
8 - Asteroid

 

Hey, is there a way to get each parameter passed into control parameter to different file output?

currently all records of batch macro are being collated into a single file however i want different file outputs every time a parameter is passed into the control parameter!
I cant use the workflow method u mentioned because i am using dynamic filter to update my filter values via macro.
Therefore I cant attach file tool to the update value tool because I have already attached filter tool to it.

Labels
Top Solution Authors