community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
#SANTALYTICS

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More

Linking directory tool to the dynamic input tool

Atom

I need to perform a task DYNAMICALLY on a subset of files from a set of files. I tried using the directory tool and got the entire set of required files from a folder. Any insights on how to now choose a subset of files from the directory tool and use them with the dynamic input tool to perform a set of tasks dynamically (repetitively using different subsets of files each time)  ? 

Alteryx Partner

Hi,

 

If you cannot already filter it from the wildcard option (e.g. *.csv), then I would create a wildcard list in a text input tool, e.g.

 

WildcardName

 

Name1

Name2

Name3

 

I would then use a Find/Replace tool to do find from the directory list any files that match the list in your text input tool. Filter out the results that don't have any matches and you have the files you want. Does that work?

Bolide
Bolide

Hi @NA 

 

There's a few ways to do this, and the best will depend on how many files you're bringing in and (more importantly) what those files look like. If all your files look the same (i.e. same field names and width etc.) then the Dynamic Input tool alone will do the trick. 

 

If you want to bring in multiple files that look (even slightly) different, then you'll want to put it in a macro, so that it can handle one file at a time. Both examples below and attached:

DynamicInput2.PNG

 

 

Thanks

Andy 

Alteryx Partner

Of course, a filter is a great & simple way as well! That should really be the first port of call before creating a separate text file as a "master" list. I would suggest Andy's approach if you have a simple list of files to filter, but if the list is quite long, I would start to look at creating a master reference file instead (as I originally suggested).

Dear Tom,

 

I wouuld like some insights regarding a certain error I have been getting on the Dynamic Input Tool, after I connect it to the directory tool.

 

The directory tool is connected to a folder on a server that contains only .xls files, that are all similar and have the same number of columns and overall structure.

Then I connect the dynamic input tool, I select one of the documents in the folder as Input Data Source Template, and the tool is able to read it just fine. I use "Read a List od Data Sources" and therein I choose FullPath and Change Entire File path respectively.

 

When I run the workflow though I get the following errors/informations.

 

"No table chosen; Please select a Table from data source" and

"the file xxxxxxx.xls has a different number of fields than the 1st file in the set and will be skipped"

 

As I said, when I chose the Input Data Source Template, the tool reads its table just fine. Also all documents havethe same structure, hence why I dont understand why I have these errors.

 

Thank you in advance.

 

Michael Lambaskis

 

 

Dear Andy,

 

I would like some insights regarding a certain error I have been getting on the Dynamic Input Tool, after I connect it to the directory tool.

 

The directory tool is connected to a folder on a server that contains only .xls files, that are all similar and have the same number of columns and overall structure.

Then I connect the dynamic input tool, I select one of the documents in the folder as Input Data Source Template, and the tool is able to read it just fine. I use "Read a List od Data Sources" and therein I choose FullPath and Change Entire File path respectively.

 

When I run the workflow though I get the following errors/informations.

 

"No table chosen; Please select a Table from data source" and

"the file xxxxxxx.xls has a different number of fields than the 1st file in the set and will be skipped"

 

As I said, when I chose the Input Data Source Template, the tool reads its table just fine. Also all documents havethe same structure, hence why I dont understand why I have these errors.

 

Thank you in advance.

 

Michael Lambaskis

 

Alteryx Partner

Hi @Michael_Lambaskis ,

 

Think that happens when:

 

1. One of the files does not have the sheet you're trying to read (look out for files that may be in the source directory that you didn't actually want to read)

2. Most likely the problem in 1. is also causing the 2nd problem - a field you're not expecting. The tool needs the template to stay the same, i.e. no different fields

 

If you still have no joy, you should look to download the Wildcard macro (Crew Macros from http://www.chaosreignswithin.com/) as it does not care if the format is the same or not. There are many useful tools there - developed by actual Alteryx developers - let me know if you need more of a pointer here.

 

Hope that helps.

Labels