Alteryx Designer Desktop Discussions

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

Select a file to process - Macro build

jdelaguila
8 - Asteroid

I'm attempting to build a standard macro that allows you to choose what file you want to process, from a certain folder, right at the beginning. Attached is my failed attempt at doing this. 

 

Can anyone shed some insight on what i am doing wrong?  Side note - i'm just starting to learn macros so i'm a begginer.

 

Javier 

6 REPLIES 6
RishiK
Alteryx
Alteryx

@jdelaguila I have modified your macro slightly to include a Macro Output. This allows the user to use the Macro at the start of their workflow, and it forms an anchor as per the Screenshot:

 

RishiK_0-1624483974389.png

Were you trying to replicate something like this?

jdelaguila
8 - Asteroid

Yes, this is closer - but now I'm getting an error message (see below).

 

Since I'm using a Directory Input - would this be causing the error? I tried using a "Input Data" tool in the Macro instead - but it kept pointing me to the same file I chose in the macro.

End goal is - I'm trying to get the macro to process whatever file I choose in the "Interface File Browse" tool.

 

Thanks for any further help anyone else can provide!  Javier

 

jdelaguila_0-1624507575641.png

 

apathetichell
18 - Pollux

2021-06-23 (7).png

2021-06-23 (8).png

  

Are you looking for a file or a directory? directory/folder browse is for folders - file browse is for files. To bring in a specific file you need to set up what type of file you are bringing in beforehand OR set up a series of tools to edit the filetype which is being brought in.  Different filetypes are in different format and Alteyrx requires knowing what kind of format the file is - as well as the name of the file. Some types of files (i.e. .xlsx also require other goodies like specific worksheet identifiers) so this requires a specific batch macro to make it even slightly dynamic in terms of file types...

 

Here's some quick edits to @RishiK's  macro to bring in a directory and show you all of the files in the directory.

 

Note: when you get it. Open the macro. See what directory it's pointing at (the error message you are getting above is because the macro is still pointing to @RishiK 's machine. Fix that. Save that. Close the macro. And then run your workflow.

jdelaguila
8 - Asteroid

Thank you @apathetichell for the above response. I feel like I'm almost there, but am missing the part where I can choose a different file every time.

 

As a side note the file i choose every time would be in the same structure and would always be a .txt tab delimited file with no quotes.

 

The attached macro works for me now - but its choosing the same file every time. Would like to be able to choose a different file to process every time - once again files would aways have the same structure and same file type.

 

Thanks again everyone for any help that can be given! Javier

apathetichell
18 - Pollux

2021-06-24 (3).png

Hi! Right now your action tool isn't configured to update it - you need to set it to update value as show above. Give that a try. and remember that you need to save and close your macro in order for the changes to take effect.

jdelaguila
8 - Asteroid

Holy moly - I can't believe I missed that little checkmark at the bottom. All works now!

 

Thank you both for helping me out!

 

Javier

Labels