Alteryx Designer Desktop Discussions

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

Batch Macro from csv file doesn't put the FileName through in the workflow

sabrinapwnd
5 - Atom

I have got n files in a directory, they are partly .xlsx and partly .csv

 

I want to append all of them to one table and add a datetimestamp and also add the source file as a field.

 

I have created two batch macros, one for each file type which within the macro both do what they are meant to (adding a column FileName and datetimestamp).

 

Macro .csv.pngMacro .xlsx.png

 

However, when I pull these two macros into a workflow to create one single table which I output into my MySQL database, the FileName column disappears from the output.

 

I struggle to understand why something that is output within my macros is not output from my macros the same way in the workflow.

 

Thank you!

 

PS: the dynamic rename is just to normalise the field names for the union "by column name"

4 REPLIES 4
caltang
17 - Castor
17 - Castor

Could you provide some dummy data or package it as an Alteryx Package (.yxzp)?

 

Are you saying that the FileName up till Union exists, but disappears at Output only? 

 

Have you tried enabling this?

caltang_0-1676386723431.png

 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
sabrinapwnd
5 - Atom

Hi there, thanks for your quick reply. I'm attaching data from one of the files.

 

Sorry, this wasn't clear, the FileName is not available at all in the workflow.

 

It is available within the Macros but when I use the Macros in the workflow the FileName doesn't exist even right after the macro as  shown in the select tool in the screenshot of the workflow below.

Workflow.png

apathetichell
18 - Pollux

@sabrinapwnd - your issue is that your action tool to your csv macro is not configured correctly. It is only reading in one file (the one you set it up with) - not all of the files in your directory. It may be reading in that file multiple times - but it's only reading in that one file.

 

Your action tool as set up is updating the outputfilename property in the action tool with the name of your csv file - that's not going to work. that controls if you are outputting the filename and if you want to output the fullpath or the filename. The value there should be 'FileName'

 

Like with your .xlsx macro - you want to update the read path - in this case it's File - Value. If you edit your macro to select that you will see the csv's filename (and all of the csv files)

sabrinapwnd
5 - Atom

Amazing, this was exactly it! Thank you so much :)

Labels