Is there a way to create an Flat file XML layout with Alteryx? Looking to create a flat file something like this:
<flatfile version="1">
<file
path="Filename.txt"
eoltype="crlf"
/>
<fields>
<field name="Field1" type="V_String" length="20"/>
<field name="Field2" type="V_String" length="1"/>
<field name="Field3" type="Double" length="19"/>
<field name="Field4" type="V_String" length="25"/>
</fields>
</flatfile>
Looking to create a Layout to send to the Client along with my final flat file everytime. Not sure if Altyerx has a nifty tool that can do this.
Thanks! Javier
Solved! Go to Solution.
Hi @jdelaguila
The tricky part here is that your Double field is 19 wide, but standard doubles are 8. To get around this convert the double to a string with the size you need. You can use an Output Data tool configured to write as .flat format
Your output will look like this
If you need the 3rd column to be right justified, include a formula tool with PadLeft() adding spaces or zeros as required
To get the xml Layout file, use a Field Info tool on both the original and resized datasets and join these on name. Build up the field info lines and concat them together. Append this to the Header, which has the dynamic path in it and the footer. Build and output the XML Layout file
Dan