Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Batch Macro Creating Duplicates

ghuttofrim100
5 - Atom

Hello, I have a directory of files that I need to read in through a batch macro that I created. For some reason this batch macro is reading in the same files multiple times. I have tried using the unique tool to fix this issue but it hasn't worked. Thank you in advance.

ghuttofrim100_0-1636649571629.png

ghuttofrim100_1-1636649631260.png

 

 

3 REPLIES 3
DavidP
17 - Castor
17 - Castor

Hi @ghuttofrim100 

 

I'll have to see a bit more of what your action tool is doing and also look at the settings in the Interface Designer.

 

I assume you get a list of xls files from the directory tool that you're then setting as the field in your control parameter.

 

Since you're not specifying a sheet name in the control parameter, I assume all sheets are named sheet1, so you're only replacing the field name and path up to the |||

 

In the Interface Designer settings you want to do this:

 

DavidP_0-1636655856200.png

 

 

 

ghuttofrim100
5 - Atom

Hi @davidP, thank you very much for your help. This is a screenshot of the Action tool in the interface:

Alteryx Question.png

 

 

All sheet names from all files are 'Sheet0'. I have the output mode configured as you showed. I'm not sure why it is still pulling in duplicates. Thank you

DavidP
17 - Castor
17 - Castor

Your directory tool produces an output like this:

 

DavidP_0-1636671674422.png

With the Action tool in your batch macro, you're looking to update the filename and path in the Input data tool, but note that this also includes the sheet name in the input tool. You can therefore either add a formula tool after your directory tool to add "|||Sheet0" to [Fullpath] in order to use that to Update the value in the Input Data tool, or, you tell the action tool to only update the path and filename - you do this by checking the "Replace a specific string" at the bottom and specify that only the filename and path gets replaced, leaving the sheet name intact, as shown below.

 

 

DavidP_1-1636671761778.png

 

Sample workflow and macro attached.

 

 

Labels