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

Alteryx Designer Desktop Discussions

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

Batch Macro

gantaanvesh
8 - Asteroid

Hi All,
I am trying to create a batch macro to read the multiple .txt files from different folders. So i have followed the below method attached in the 2nd & 3rd image to achieve the goal.

But now i had challenge that files has to read based on the control table as shown below because if any new files comes in some different folders we will be updating the control table file by giving the source file name, file path and target paths so that based on this condition files should read and write in the macro. Can someone help me with logic how to give that parameters.
Thanks in advance

gantaanvesh_2-1663845092589.png

 

gantaanvesh_0-1663844647466.png

gantaanvesh_1-1663844851186.png

 

 

9 REPLIES 9
Qiu
21 - Polaris
21 - Polaris

@gantaanvesh 
Can you give a bigger picture for the 2nd one? and better a sample workflow.

gantaanvesh
8 - Asteroid

@Qiu  I have attached the workflows and the control table based on which i wanted to read the source file and write to target path 

gantaanvesh_0-1663846808846.png

 

Qiu
21 - Polaris
21 - Polaris

@gantaanvesh 
Thank you for the follow up.
Here are my thoughts for your consideration.

  • The path shall be fixed as input for the Directory Tool.
  • The control table provides the schedma which should be same for the files you are going to read. This should be better saved as same path of your workflow.
  • For the output path, you can bring it in the workflow then specifiy it in the Output tool.
gantaanvesh
8 - Asteroid

Hi @Qiu 
Thanks for the response. 
I tried the steps that mentioned in the previous reply but unfortunately am not able to achieve the solution, can you please help me with the workflow.

 

grazitti_sapna
17 - Castor

@gantaanvesh , I have made few changes in your workflow. Please try it once and you need to check the include subdirectories checkbox.

Sapna Gupta
gantaanvesh
8 - Asteroid

Hi @grazitti_sapna 

I can see the only change in the workflow is include subdirectories checkbox, but in my case its not mandatory that folders will there in one parent folder it can be in any other folder as well. Basically files should read and write based on the control table details as attached in the above image

grazitti_sapna
17 - Castor

@gantaanvesh , In that case you will have to change your workflow into macro and add control parameter to send the values from control table one by one and process it. So your workflow will have nested macro one for directory update and other for data fetch in each directory.

Sapna Gupta
gantaanvesh
8 - Asteroid

Hello

I am trying to modify the batch macro for reading and writing the files based on the source path and target path given in the control table file

gantaanvesh_0-1663878345711.png

When i ran without output file it is giving me an result but when i add the output and in the macro am getting the below error, can someone help me on the same

gantaanvesh_1-1663878448174.png

 

 

MattBSlalom
11 - Bolide

Note that in the Macro screenshot you provided, the Control Parameter is updating the file path value including the Excel sheet name.  The value from your parent workflow is likely missing the sheet name appended to the end of the file path.  The expected format is <file path>|||<sheet name>.  For example, "C:\temp\New Microsoft Excel Worksheet.xlsx|||Sheet1"

MattBSlalom_0-1664221858077.png

 

 

Labels