Alteryx Designer Desktop Discussions

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

Multiple Files - Unknown File Type - Convert to Flat File

frank6773
8 - Asteroid

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.

9 REPLIES 9
geraldo
13 - Pulsar

@frank6773 

 

I set it to read the files.
the way they are.
now need to see what

frank6773
8 - Asteroid

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...

geraldo
13 - Pulsar

@frank6773 

 


an example using macro

frank6773
8 - Asteroid

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.

geraldo
13 - Pulsar

@frank6773 

 


I thought I was repeating too but the city and date are the only ones that change

geraldo
13 - Pulsar

@frank6773 

 


this is your version
configuration for it to work
change the parameters to the path of your machine

 

part1.JPGpart3.JPGparte2.JPG

frank6773
8 - Asteroid

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.

geraldo
13 - Pulsar

@frank6773 

 


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

frank6773
8 - Asteroid

Hi Geraldo, it worked!  I totally misunderstood your original solution, thanks for the graphics!!  Cheers and have a great weekend!

Labels