Is it possible to create nested loops in XMLPort, which is used for exporting txt file?
My XMLPort successfully creates txt file - one row per each record in my table. But I need some extra rows in the exported txt file - headers and trailers. it's like GroupHeader and GroupFooter in classic report. Something like that:
Header1
Line1
Line2
Trailer1
Header2
Line3
Line4
Trailer2
I need to retrieve Header, Line and Trailer values from the same table, but Header row in txt file has different structure (obviuosly) than Line row. I know, how to create Header once, using Integer. But I do not know how to creater Header2 and get back to line structure again. I was goint to use nested loops, but XMLPort does not allow to set different indentation for the element = table.
Any tricks?
0
Comments
RIS Plus, LLC
How would you use XMLPort to export several purchase invoices, so in text file you would have data from the purchase header in the first row, then several rows from purchase line, then another row from the next purchase invoice header, then its lines, etc. ? Is it possible with XMLPort?
Instead of thinking 1 header, multiple lines, you need to think about repeating the header values for each line, like I did in the example. The text file that I show at the start of the demo (the one with multiple lines for the second invoice) is your target file format. You could theoretically think about not repeating the header fields but only showing those once, but I actually like the repeating nature because it clearly shows all relevant attributes, which is especially useful if you have large numbers of lines per document.
If you want the nested tables idea, you'll have to use XML, text files can't be formatted that way. Unfortunately those are the limitations of XMLPorts.
RIS Plus, LLC
In fact, I already have all necessary data in one single table, the only problem is grouping. I have several groups and I have to create header and trail for each group and all of this should be in the one text file. I don't think there is a way to create more than one row in text file per record in the table with the XMLPort, right?
I think I need to forget about XML Port and use REPEAT ..UNTIL to loop through the table and write data to the File variable. With that, I can create as many extra rows (headers/trails) as I need based on my data.
Thanks anyways!
RIS Plus, LLC
This is right answer!