Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Create a flat file on the Fly

Jason_
Asteroide

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 RESPUESTAS 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_
Asteroide

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.

Etiquetas
Autores con mayor cantidad de soluciones