Alteryx Designer Desktop Discussions

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

Directory - Multiple unique file iterative read/process, then Consolidate

PeteLacz
8 - Asteroid

I have a directory containing 25 LARGE (record limit 1 required) files (All with different schema). I am attempting to perform a Field View (Or metadata) on each file, and then export that information into an excel file. Now... I understand I could do this manually. But I should be able to automate this by using the Directory, and have a workflow cycle through each file, and then post each files information in a different tab within the same excel workbook (OR Union the data, because metadata columns are similar while the underlying datasets might not be).

 

I was able to use 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CS-Macro-Dev-Reading-in-Multiple-Fi...

to perform a field view on the grouped data, but unfortunately it started showing the source as 'File: (Multiple Sources)' which is not useful at all. I would rather have the duplicate rows showing the different sources. 

 

I imagine an iterative macro would be needed here.

4 REPLIES 4
porter_samu
6 - Meteoroid

@PeteLacz based on your request, it appears this may resolve your issue.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Dynamic-Input-Tool-Import-Multiple-Exc...

 

If you read in all the files from your directory and then feed them through a Dynamic Input tool followed by a Field Info tool, you should be able to get the field info for each file in the directory.

echuong1
Alteryx Alumni (Retired)

Is this what you're looking for?

 

This will loop through all files in the directory specified, pull each sheet from each file and generate the field info. From there, you can export it to separate sheets based on the file/sheet name (parsed out with regex).

 

echuong1_0-1602724195116.png

 

PeteLacz
8 - Asteroid

Thanks porter_samu,

 

Unfortunately the dynamic input function won't play well when reading in different files with different schema. Also, I am specifically trying to read in SAS7BDAT files. So sheets won't be a consideration. I played around with the workflow and modified it for those files, but dynamic input wasn't having it. That said, I believe the solution has been found below.

PeteLacz
8 - Asteroid

Thank you Echuong!

 

I had to insert a formula function between the directory and the two macros you grouped into one to specify the file path. It worked! I allowed me to pool in all the field info data for each file and stack them with the redundancies I was looking for. I also modified it for SAS7BDAT files.

 

You showed me I was close to the answer on my own, but it didn't occur to me group the macros like you did. Thanks again.

Labels
Top Solution Authors