One problem with the file layout editor in Application Designer is that you cannot see the fields in order in which they appear in the file. For XML files, this does not matter, but for CSV files or flat files, the order is very important, especially in troubleshooting.
Here is some SQL that will show you the fields in the correct order (Just replace the <File Layout Here>):
[sourcecode language=’sql’]SELECT * FROM PSFLDFIELDDEFN
WHERE FLDDEFNNAME = ‘
ORDER BY FLDSTART[/sourcecode]