Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Fixed Length File

anom23
7 - Meteor

Hi Everyone, 

 

I have a fixed length file which I have been attempting to parse with no luck.  The issue I am having is the file has a header record (1), batch header (5), entry detail (6), return record (7) and batch control (8).  When i attempted to create a Txt file to match it initially works, but because header record and batch record and entry detail are in the same positions it fails.  See the attach file and spec doc.  Below is the map I attempted at first.  I have not tried regex but I am not sure if that is a viable option.   

 

 

 

 

<flatfile version="1">
<file
path="\\G:\My Drive\Alteryx Automation.TXT"
eoltype="crlf"
/>
<fields>
<field name="RECORD TYPE CODE" type="VString" length="1"/>
<field name="PRIORITY CODE" type="VString" length="2"/>
<field name="IMMEDIATE DESTINATION" type="VString" length="10"/>
<field name="IMMEDIATE ORIGIN" type="VString" length="10"/>
<field name="FILE CREATION DATE" type="VString" length="6"/>
<field name="FILE CREATION TIME" type="VString" length="4"/>
<field name="FILE ID MODIFIER" type="VString" length="1"/>
<field name="RECORD SIZE" type="VString" length="3"/>
<field name="BLOCKING FACTOR" type="VString" length="2"/>
<field name="FORMAT CODE" type="VString" length="1"/>
<field name="IMMEDIATE DESTINATION NAME" type="VString" length="23"/>
<field name="IMMEDIATE ORIGIN NAME" type="VString" length="23"/>
<field name="REFERENCE CODE" type="VString" length="8"/>
<field name="RECORD TYPE CODE" type="VString" length="1"/>
<field name="SERVICE CLASS CODE" type="VString" length="3"/>
<field name="COMPANY NAME" type="VString" length="16"/>
<field name="COMPANY DISCRETIONARY DATA" type="VString" length="20"/>

</fields>
</flatfile>

2 REPLIES 2
patrick_mcauliffe
14 - Magnetar
14 - Magnetar

Hey @anom23 - you're right.  Regex would work here.

I've attached an example where the first type is parsed out and you should be able to follow and create the rest of them.

Basically, we're intaking the file as a blob so we don't have to declare it's format up front.  After we parse to rows, we can treat the rows separately based on their identifier.

 

anom23
7 - Meteor

This is exactly what I needed Patrick!! Thank you for the quick reply.

Labels
Top Solution Authors