Conforming field types for dynamic input
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Labels:
- Batch Macro
- Dynamic Processing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
