I would like to create a batch macro to process the data below. Iterate through the settings table, one process for each row. Append the three columns in settings to each group of data using column one as control parameter.
settings
A | 3 | 4 | 5 |
B | 1 | 2 | 7 |
C | 4 | 4 | 4 |
data
A | 13276 |
A | 23417 |
A | 44456 |
B | 87934 |
B | 34321 |
C | 33430 |
C | 33428 |
The output should be three files. One for each row in settings.
A | 13276 | 3 | 4 | 5 |
A | 23417 | 3 | 4 | 5 |
A | 44456 | 3 | 4 | 5 |
B | 87934 | 1 | 2 | 7 |
B | 34321 | 1 | 2 | 7 |
C | 33430 | 4 | 4 | 4 |
C | 33428 | 4 | 4 | 4 |
Each iteration would produce one of the output files above. If someone could please give me insight, is this possible and how would I achieve this?
Hi @dpan
You don't need a Batch macro to do the job here.
Just use a join tool to append the desired columns, and then use the Output Data tool configured to produce a file for each instance of your "Letter" field.
You can set the file name appending suffix/prepending prefix, or even creating an entire different file path for each file using a Formula Tool before the Output Data tool.
Cheers,
Hi @dpan ,
Find attached a way of doing that.
Each file contains the lines of unique letters.
Let me know if there is an issue.
My over simplification of what I am after caused confusion. Each of those outputs would be processed further using those three new columns to use as counters of rows to include in the final outputed files. So I am not sure your approach would work. I need those datasets at the beginning of each batch to manipulate and create the final files. Those columns would be: Give me a file that consists of x rows with the earliest date, where x is the first column value. Then y rows with the earliest date, where y is the second column value. And so with the third column.
I am new to Alteryx, coming from JAVA programming. So what I am trying to achieve is the equivalent of a loop in which I take each group (A,B,C) and apply the settings to each to produce a separate file for each group.