Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic Input with a schema

LincolnMike
8 - Asteroid

Hello,

I have several TXT files (which I will save as CSV) with 5 identical fields and length.   The fields are not delimited,  but I know the field length for each: 17, 4, 1 ,3 , 2.  Fields are VIN, MY, Status, Country, Group.

I thought I could read them using a Directory Tool and an Dynamic Input Data Source Template, but I can't see where I could insert my field names and field length.  In MS access I could do this with a Specification file.

 

Any ideas?

 

 

4 REPLIES 4
JohnR
7 - Meteor

Choose File Format to be Flat ASCII file (*.flat)

It will prompt you for field widths

LincolnMike
8 - Asteroid

Thanks John.  It did get me a bit further, but in reality I have 38 field names that vary from 1 to 254 in field length.  Is there a way to use a file specification and import?

I read the help and I thought I had the spec data correct, but I get an error  Data at Root Level is invalid.

My spec file for example is saved as file type ".asc" and the here is a list of the first 9 rows in the spec file:

vin,17
my,4
b,1
veh,30
RspDlrStatus,1
DlrGEO,3
Seg0,2
VG0,2
VG0x,254

JohnR
7 - Meteor

 

The specification file should look like this, it should be saved as a *.flat

 

 

<flatfile version="1">
<file
path="yourpath\yourfilename.asc"
eoltype="crlf"
/>
<fields>
<field name="my" type="V_String" length="4"/>
<field name="b" type="V_String" length="1"/>
.
.
.
<field name="VG0" type="V_String" length="254"/>
</fields>
</flatfile>

 

If you can create a file in Alteryx with the same fields and formats as your target you can save it a s a flat file and it will create the specification file for you

LincolnMike
8 - Asteroid

Hi John,

sorry for late response...I've been away for a while.

Your solution worked perfect for my needs.

Labels
Top Solution Authors