Alteryx Designer Desktop Discussions

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

Merge 3 table values into one flat file

nshah48
7 - Meteor

I have a workflow that produces 3 output values, Header row, Detail rows and Trailer row. I would like to merge them so I can output into a single flat file. Now sure how can I achieve this

 

here's my workflow

Workflow.JPG

Here's are the 3 table values I needed them to be merged into a single Flat file

2 REPLIES 2
Felipe_Ribeir0
16 - Nebula

Hi @nshah48 

 

This is not a direct answer with your data, but you can see how it works and adapt to your case.

 

1)First, you need to know the length that each field need to have. For example, you can have the a column with name project and first cell with the data project2 (8 characters), but lets assume that the length of this field inside of the flat file according with the specifications need to be 70. So you would need to add a lot of space characters to the right of it.

 

This can be achieved with the padright function (for numbers, it is usually padleft and filling with 0). This tricky needs to be applied to each column individually:

Felipe_Ribeir0_0-1673566860173.png

 

2)After having each field with the specified length, you gonna concatenate it all:

Felipe_Ribeir0_1-1673566931510.png

 

3-The above steps need to be done for Header/Detail and Trailer separately. Each one will have its own specification and data. After doing it, you will union it all to make 1 file:

 

Felipe_Ribeir0_2-1673566999480.png

And in the end, you will save it as a flat file.

 

Felipe_Ribeir0_3-1673567101743.png

 

The flat file is basically a text file. ofc i used some dummy data that does not even make sense, so it is not looking good as the result that i have with real data.

 

Felipe_Ribeir0_4-1673567531376.png

 

 

 

 

With this overall idea, the attached example (dummy data) and some work, i believe that you gonna be able to do it.

 

 

 

 

 

nshah48
7 - Meteor

Thanks, Felipe_Ribeir0 I used your idea and merged each record (Header, Body and Trailer) into one field with a record length of 82 and then union them together and tried exporting to a flat file and it worked/

 

Labels