We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Load unknown number of files

VJ_88
8 - Asteroid

Hi,

I have a typical scenario,

We have around 18 -19 files, numbers might grow
Column is not fixed , example File A might have more 10 column a day and 12 another day


Solution

Since columns are not fixed but 5 columns will always be there in every file
So, we decided to create a solution like 
we kept  7 columns in table 05 for fixed 6th for all rest column names and 7th for those columns values which means
we generated record ID unique for each row
suppose we have 10 columns , values for first 5 columns will be repeated in 5 rows and rest 5 column will be transposed in 6th & 7th

 

Problem Statement
   Since, columns sequence is not fixed we are trying 
    if we load first row as data and somehow identify header to identify fixed 5 columns since  these 05 fixed columns could be first 5 ,
    last 5 or in middle 
   Also how can we design a solution to have these dynamic like if number files grow it should accommodate in same solution
   in a particular file column can increase or decrease  

4 REPLIES 4
nagakavyasri
12 - Quasar

You can use 'Directory' tool and give path of the folder which has all input files

 

Screenshot 2024-09-17 141841.png

lwolfie
11 - Bolide

You could use a macro that inputs each file individually with the interface designer set to Auto Configure by Name or position (depending on if it's always the first 5 columns or specific column names) and Output fields based on the macro configuration.  You can then use the select tool to reorder them on output.  

 

I usually do the name selection and then reorder after that.

apathetichell
20 - Arcturus

As @lwolfie points out - you will need a batch macro. you may want to do something like bring in no headers. use a record id. use a filte to determine where your headers start. figure out the minimum column of your headers. append this to your data - filter out rows before your headers... etc.

 

 

OTrieger
14 - Magnetar

@VJ_88 

One way to do it will be to use the Field Info Tool in a batch macro, union all the possible headers from all files and then use a unique tool that will leave you will all unique headers. Add a RecordID so each header will have a unique number, then transpose using the RecordID as the headers, so Alteryx will not modify any of the names. Then with a Dynamic Renaming tool take the first row and now you have all the headers as is.
Send the headers into a different batch macro that will open each file and union with the headers. The batch macro output will be the aggregation of all the data based on their headers.

Labels
Top Solution Authors