Multiple Files - Unknown File Type - Convert to Flat File
- 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 multiple files that come in daily without any usable extension. They are all fixed width data files. Using an Input tool, I can create a *.flat template with the appropriate field names, save it, and use it to decipher the file on a one by one basis. Basically, select the file manually being unknown, select the template, and we're good to go. However, any attempts at getting all the files at the same time from a folder using a directory tool with a dynamic input tool has not worked for me. I would like to merge all the data from all the files into a table using this same template. Can someone please tell me what I am doing wrong? I have used this for Excel, CSV, etc with no issues but somehow not having that extension to key on is tripping Alteryx up. I have gotten access denied errors and the latest is "Missing Root Element 'flatfile'" which I think is because it is expecting the data to be in XML like the template is. I have attached the workflow and sample files as well as the template in the zip folder.
Solved! Go to Solution.
- Labels:
- Error Message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello Geraldo, I am not sure what you changed but it is still not working for me. I am getting "Access is denied". I need all the files with the unknown names to be picked up by the directory tool and sent into the dynamic input to be parsed using the *.flat file that I submitted in the zip. The top portion of the workflow shows how I got it to work using just 1 file but what I need is for it to pick up several files at once and parse according to the *.flat XML template. Thanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you Geraldo, I am definitely much closer but I'm relatively new at using macros so must be doing something wrong. When I run the workflow with the appropriate paths for my computer and I have 4 files there, the 4 FullPath records go into the macro with the correct file names but what comes out is the same file data (1936991555991230.20230609.02.0550) that you have setup in the macro four times. How do I get the macro to actually pull the data for each separate file? Sorry if this is something simple I'm missing and again thanks for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
this is your version
configuration for it to work
change the parameters to the path of your machine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Geraldo, in my results, I am getting the exact data for file 1936991555991230.20230609.02.0550 4 times. I have attached .txt versions of the files to be able to open in any editor to see that there is different data in them. The file value in the macro for the action tool shows the file value as 1936991555991230.20230609.02.0550, how can this be made to change based on the input from the FullPath going into it? Thanks again, sorry for the questions but just trying to get it to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You even opened the code I sent you for your version without a macro.
I made the necessary adjustments
and you changed to xml the replace and what it should be is replace value.
If you have more than one type of xml file it has to be macro. but if it is a single xml file it can be in the version without macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Geraldo, it worked! I totally misunderstood your original solution, thanks for the graphics!! Cheers and have a great weekend!
