Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Import text file and split into multiple outputs

matt_r
5 - Atom

Hi All,

 

I am struggling to come up with a workflow to import and transform the attached file.

 

I need to be able to import the file, split the file into multiple tables (e.g. TABLE ET_ARC, TABLE ET_ARCMAT etc.) and then parse each table into multiple columns.

 

Any help / suggestions would be appreciated.

 

2019-02-14_14-38-08.jpg

5 REPLIES 5
DiganP
Alteryx Alumni (Retired)

@matt_r  I would read the text file as a fixed width text file and set the appropriate parameters based on the string length. 

Digan
Alteryx
DavidP
17 - Castor
17 - Castor

Right, here's the 1st of 2 posts.

 

In this post, I've loaded your text file, created a Table identifier and parsed the first table to columns as shown below.

 

Workflow attached. 

 

In my next post I will turn the second part of the workflow into a batch macro that will parse each of the 45 tables contained in the text file and write each table to a separate sheet of an excel file.

 

At the moment all the fields are still text so we'll also have to look at how to turn some of them into numbers.

 

parse text file 1.png

DavidP
17 - Castor
17 - Castor

Here's the macro with the output file.

 

parse text file 2.png

DavidP
17 - Castor
17 - Castor

I've now fixed the number format (converted scientific format to numbers) in the macro. Please find final version attached. Let me know if you have any problems running it.

matt_r
5 - Atom

Brilliant DavidP... didn't have any problems running it. It'll just take me a while to understand it :)

Labels