Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Dynamic wildcard file search

TH
8 - Asteroid

I'm trying to set up a workflow to allow a user to specify a filepath and filename (which may include any number of wildcard characters), and then determine whether that path/name combination matches any files. Ultimately the goal is to turn it into a macro.

I've tried -

File Input (regular or user-specified text) with a Formula tool to run a FileExists() command- This doesn't like wildcards.

Dir - Plays nice with wildcards. Requires a file template and that I specify the path and name parameters in the tool itself. It also won't convert to a macro.

Dynamic Input tool looks like it should help, but it requires a specific input template. That's not really in the parameters of the end goal.

 

I have to think that this would be fairly straightforward in a coding language like Pythonl I just haven't written out the script yet.

 

What's the best way to accomplish this sort of task in Alteryx?

5 REPLIES 5
AkimasaKajitani
17 - Castor
17 - Castor

Hi @TH ,

 

In this case, you can use Directory tool. You can specify the directory and/or file name.

 

AkimasaKajitani_0-1637635443151.png

 

After that, you can use Dynamic Input tool to read the files. Or you can use the Batch macro if the file have different schema.

 

TH
8 - Asteroid

I appreciate your thought, but the Directory tool -> Dynamic Input Tool combination does not work here to accomplish the goal.

 

As I said, the goal is to turn this into a macro (so that it can be passed around and reused), and the Directory tool does not have the option to become a macro.

Secondly, part of the point is to allow the user to pass in a file path and name in a similar manner as with a Text Input tool or a Macro input. This isn't possible with the Directory tool.

Third, I'm not trying to load files, so a Dynamic Input tool is superfluous at best.

 

Please help me to set up a macro that allows for data input or runtime-user input with wildcards and then will search the specified filepath(s) for (the) matching file(s).

AkimasaKajitani
17 - Castor
17 - Castor

Hi @TH ,

 

I may not have understood your intentions very well.

 

If you don't have the file list to validate, I think the Directory tool work well.

I made this macro.

 

AkimasaKajitani_2-1637641756336.png

 

This is sample workflow to use the macro.

AkimasaKajitani_1-1637641733133.png

 

AkimasaKajitani_0-1637641727357.png

 

The Directory tool can use wildcard. It is easy to use the wildcard.

 

 

But If you have the file list to validate, you can use Directory tool that you have to put into batch macro.

AkimasaKajitani_3-1637642225221.png

This is sample workflow to use the macro.

AkimasaKajitani_4-1637642236735.png

 

 

 

 

If you have the file list to validate, I think that another way is to use RegEx_Match expression. 

 

AkimasaKajitani_5-1637642651771.png

 

 

Please check the attached workflow.

 

sriniprad08
11 - Bolide

Hi @AkimasaKajitani 

 

Hope you are well.Thanks for providing the great input and example. I have a similar problem please find below

 I have a sql database with list of files. The alteryx flow should take user inputs and the app search through the database to look for file name and return "the location of the file" or "the file itself."

 

Please let me know how to go about this,

 

Thanks,

Sri

AkimasaKajitani
17 - Castor
17 - Castor

Hi @sriniprad08

 

If the database have file lists, you can use the sample workflow "Sample_DirectoryToolBatch.yxzp".

But you have to modify the workflow to fit the file type to read.

 

If the daatabase have the files themselves(In this case, I think the database has the files as blob type), you have to make quite new workflow.

In this case, you have to make a batch macro which you use Blob Output tool to save the file and then, you use Data Input tool to read that file. 

 

If you have any question, let me know.

Labels