Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Create a flat file on the Fly

Jason_
7 - Meteor

Does anyone have experience creating a flatfile on the fly, then using that flatfile to read in a file?

I have metadata containing field names, start position and length. For example:

 

Input:

Field Name|Start Pos|Length

Field_1|1|3

Field_2|4|9

Field_3|13|10

 

Desired Output:

<flatfile version="1">
<file eoltype="crlf" allowShortLines="t" allowLongLines="f" trimWhiteSpace="t" />
<fields>
<field name="Field_1" type="V_String" length="3" />

<field name="Field_2" type="V_String" length="9" />

<field name="Field_3" type="V_String" length="10" />

</fields>
</flatfile>

 

Next step: Pickup this flat file and assign it to an input downstream

2 REPLIES 2
BenMoss
ACE Emeritus
ACE Emeritus

Hi @Jason_ this is something I have some experience of, I personally wouldn't go about creating the intermediate 'flatfile' and instead build the logic directly into Alteryx and apply it against your dataset which would be read in as an undelimited file.

 

I've attached an example for you 🙂 and it shouldn't be to difficult to turn it into a macro.

 

Ben

Jason_
7 - Meteor

Thank you @BenMoss

 

This works beautifully, and I was able to adapt it to my environment with Headers, Trailers and 2 types of records. Now I have to figure out how to make it all variable and turn it into a macro.

Labels