Alteryx designer Discussions

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

How to feed the name of an input file into a row of the output file

Highlighted
Meteor

My workflow takes data from about 20 seperate input files that are identically formatted and different only by the name of the file (each file has a distinct name, i.e. "Widget #1," "Widget #2" etc.) and each file is fed into a seperate and (nearly) identical workflow box which are joined at the end into a single output file consisting of 20 rows of data, one row for each "Widget" and some data columns going across (weights, cost, etc). 

 

The hassle i'm having is that in order to get the output file to name each row for each individual widget, i have to manually change 2 formula tools in each workflow box (20 times) with the name of the seperate widget from the input files.  is there some way to incorporate into the workflow the names of the individual files so that each box will take the name (or portion of the name) of the file rather than this manual change in the formula tools in each workflow?

 

thanks for any help you can provide.

Highlighted
Quasar
Quasar

Hi @Rob48 , 

 

in the input tool, you have an option to output the filename as a new field as in the screenshot below (option 4)Capture d’écran 2019-07-22 à 22.05.44.png

Highlighted
Meteor

Thanks Ladarthur, that did the trick.  Now for another question - is there a way to import multiple input files into your canvas at once?  I'm putting in 20-30 files on my canvas one at a time, there's got to be a quicker way - tried to copy paste but the tool wouldn't do it.

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @Rob48 


Drag your files from your folder directly into your Alteryx Canvas and you'll have multiple input tools.

 

Cheers,

Highlighted
Magnetar
Magnetar

Hi @Rob48 

 

Absolutely! I'd go with the Dynamic Input route, 

Enormously helpful article here: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Dynamic-Input/ta-p/249...

If your files have the same schema, this will work perfectly, and you can include the file name in a column.


Let me know if that helps

Cheers!

Esther

Highlighted
Meteor

Ok, now here another one- my same 20 files I fed into 20 identical workflows manually - very painful!  is there a quicker way to feed mulltiple files into multiple workflows?

Highlighted
Meteor

Thanks Thableaus.  Another hassle:  when I get my 20 files onto my canvas i have to to two sets of very manual actions:

1. I have to set up each input option one at a time (i.e. "Output File Name as Field" and "Start Data Import on Line...")  is there any way to set my options all at once for  all the files, rather than 20 separate times?

 

2. I have to manually bring each individual file to the next tool (i.e. "Data Cleansing") and do this 20 times to 20 identical tools.  Is there a way to bring them all to the SAME tool at once, so that I am combining all the files into a single data set to work on?  

 

I've played around with the "Directory" tool and the "Dynamic Input" tool but either i'm not using them correctly or they're not designed to handle these actions.

 

any help is greatly appreciated, thanks so much

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@Rob48 

 

It depends on how the schema of your files is set.

 

If the 20 files have the same columns, same metadata and all, you can use the Dynamic Input + Directory Tool option. Although you'll need some additional configuration if you have an irregular sheet composition (e.g. Your table starts at Row 5 in Excel)

 

Other than that, you can do some XML hacking of your workflow to set up all these configs at once. 

 

If you're still beginning to use Alteryx, I recommend you to look up some resources to understand these options (for example, parsing the XML of a workflow can be tricky).


Cheers,

Meteor

When setting up the parameters of the input tool you can choose "Output File Name as Field" to add the file name as a field.  is it possible to do the same with a tab name in your file?  It would definitely be easier for my process to use one input file with multiple tabs of differing names than multiple input files of one tab each.  Any suggestions?

Highlighted
Quasar
Quasar
Yes you can do so instead of selecting a specific tab you should select the list of tab names and it works, you can combine that with a dynamic I put tool (even 2) and it works perfectly!
Labels