Alteryx Designer Desktop Discussions

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

Conforming field types for dynamic input

Ozymandius
6 - Meteoroid

I have a work flow that uses the dynamic input tool to iterate through a subset of files in subdirectories of a directory, and appends them together. This works great, until certain fields are formatted differently than the template from the source. What would the best way to modify the workflow to dynamically handle the input files and conform all fields to the same data type, or even more rarely ensure all fields are present in the off chance that certain fields have been dropped? I have began looking at batch macros but am not at all experienced with them and don't even know if that is the most efficient path forward.

5 REPLIES 5
gawa
16 - Nebula
16 - Nebula

hi @Ozymandius 

 

You wan to rad multiple files with possibly having different schema? Then, refer to the below article.

https://knowledge.alteryx.com/index/s/article/CS-Macro-Dev-Reading-in-Multiple-Files-with-Different-...

As you experienced, Dynamic Input Tool does not work well if input file has a different schema than that of 1st file read. Those are skipped(ignored).

By using Batch Macro, all file can be combined based on their field name forcebly.

Ozymandius
6 - Meteoroid

Gawa, How can I modify which files the Macro iterates through? There are many subdirectories in this directory and in those subdirectories are many files, of which I only need the most recently dated file in each.

Prometheus
12 - Quasar

@Ozymandius You can use the Directory tool to bring in the list of files in the folders, then use the Sort tool and sort descending on CreationTime, then use the Sample tool to take the top number of files you want to take. You can choose to group on any of the fields to get what you're looking for.

Ozymandius
6 - Meteoroid

@Prometheus - Thanks for the response. I have that portion set and it is working perfectly, the list of files is coming back exactly as I would like them. The issue is sometimes the file source has the field types differently for whatever reason, and this inhibits the dynamic input from functioning properly. What I was hoping for was some help with a macro or other tool to reformat all fields as text or some other common data type to let the dynamic input read all data in properly and then reformat as needed.

Ozymandius
6 - Meteoroid

I should also mention, I have tried to set up a batch macro for this, but the field in question that is sometimes formatted differently is just being set to the same as the template file. To be more specific, the field in question is called "Period" and contains yyyy.mm that the file is concerned with. The template file is 2024.05 and that value is being pasted into every row the macro returns. How can this be corrected?  

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels