Alteryx Designer Desktop Discussions

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

Parse data from text file

vvissamsetty
8 - Asteroid

Hi Guys,

I have data in the following format and wish to extract characters from this based on character limit into multiple columns.

AAAA  1234567890JOHNNEWYORK

I have multiple columns into which this data has to be extracted based on the character count like - first 4 characters should go into column 1(ID), next 10 characters should go into column 2 (Phone Number), next 4 characters into column 3(First Name), next 15 characters into column 4(City) and so on, all of this data is in a text file. Can anyone guide me on how to go with this?

Thank you

4 REPLIES 4
RolandSchubert
16 - Nebula
16 - Nebula

Hi @vvissamsetty ,

 

in the INPUT tool, you can set the option "Read it as a fixed width text file" :

 

10-10-_2019_15-49-04.png

 

In the following step, you set the field width:

10-10-_2019_15-52-21.png

Would that solve your problem?

 

Best regards

 

Roland

vvissamsetty
8 - Asteroid

Thanks @RolandSchubert, that helped.

benakesh
12 - Quasar

Hi @vvissamsetty ,

This is  Regex parse method .

(.{4})\s\s(.{10})(.{4})(.{5,15})    ( 4 char id ,  2 spaces  , 10 char phone , 4 char name and  5 to 15 char city .   

 

Rob48
8 - Asteroid

I just used the first solution that RolandSchubert gave with a .txt file I have, but didn't account for the fact my source data has a first line/row of garbage that I wanted to ignore.  Now all the field width settings I made (60 fields of varying length across 600 characters) is parsing up the first row of garbage.  Is there a way to ignore the first row and still use this solution?  Or am I stuck not using this easy (but initially time-consuming) solution and instead creating 60 separate formula tools to parse up my data?   below is the current settings.  Thanks!

 

Rob48_0-1677851725360.png

 

Labels