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?
Solved! Go to Solution.
Hi @TH ,
In this case, you can use Directory tool. You can specify the directory and/or file name.
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.
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).
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.
This is sample workflow to use the macro.
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.
This is sample workflow to use the macro.
If you have the file list to validate, I think that another way is to use RegEx_Match expression.
Please check the attached workflow.
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
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.
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |