Alteryx Designer Desktop Discussions

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

Batch Macro to filter (based on a field of my data) and save each batch into template copy

jteixeiralima
5 - Atom

Hello everyone!

 

I am quite new in Alteryx and am struggling for some time with this challenge and haven't yet found a corresponding answer here.

 

Basically I have a set of filters and tools that allows me to get my data such as something like this:

jteixeiralima_0-1666180051557.png

In this data you'll see I have multiple "Fund names" and I may have new ones as well as new "company's names" depending on the files I upload as input.


What I would like is to output the data filtered by "Fund names" and save it into a copy of a template file in a specific location like T25 - V30 (eg: Template.xlsx) including the name of the fund in that file's name (eg: Template-Infrastructure III.xlsx). And that for every possible "Fund name".

jteixeiralima_3-1666180850720.png

For this example I would like to have this as an Output for Infrastructure III and so on for other "Fund names":

jteixeiralima_1-1666180615899.png


I thought about a Batch Macro with a dynamic filter tool in it, but cannot seem to make the output tool work like I would like : create a copy of my "Template.xlsx" file, populate the "Fund name" filtered data in T25 - V30 cells, update the name of the copy file using the Fund name as a suffix save it, and repeat the task until all the Fund names have been covered and have their own "Template- suffix.xlsx" files saved.

Can anyone help me solve this challenge?

Many thanks in advance! 

4 REPLIES 4
Christina_H
14 - Magnetar

If you just wanted to output to multiple files, you can do that with just the output tool using the option to Take File/Table Name From Field.  Configure it to add your fund name to the end of the file name, or create a field with the whole file name to use.

Christina_H_0-1666184786664.png

 

To copy your template, you can use Blobs.  Blob Input to get the template file, then Blob Output to save it somewhere else (use a formula tool to create the file names you want).  Use this to create all the templates you need, then the output tool to write data to them.

jteixeiralima
5 - Atom

Hi Christina_H !

First of all many thanks for such a quick answer! :)

I didn't quite understood the first part of your answer to be honest... Correct me if I am wrong, but given I want to output data into a template: If I want to use the "Take from file name/[...] field" output option don't I need to already have the copy of my template created and saved somewhere?

I will try to ,clarify my request: the major difficulty here is that this whole process needs to be dynamic, meaning the flow/macros need to be able to create automatically, the same number of copies of the Template, as there are number of different entries under my "Fund name" field.
--> if I will have 5 different Fund names the flow should create 5 copies, then group each "batch" (companies, and related data, belonging to the same "fund name") and export each batch into one separate, of those copies of the template and change its name so that it contains the name of the fund in it. 

Hopefully this explanation gives you a little more information :)
 

Christina_H
14 - Magnetar

Hi @jteixeiralima 

 

Sorry, I didn't explain myself very clearly!  What I would do is use Blob input and output to create copies of the template, then use an output tool to add the data.  Something like this:

Christina_H_0-1666192432851.png

 

You'll need a way to make sure you don't write to the files until the templates have been copied over.

jteixeiralima
5 - Atom

Hi @Christina_H, again thank you very much for your help.

 

In the end I wasn't able to use the blob tools to create the correct. copy of my Template file, however your way of thinking, (first create the copies of files then populate them) allowed me to reach my goal. 
In the end I used this Copy Rename python code for the first part: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Copy-and-Rename-File-with-Command-Prom...

And Output tool as you said to populate the newly created templates.

 

Kind regards,

Labels