- that is, you need not only to get the text 'Light Green' from the next record, but also 'Dark Brown' from the one after that, but then go back to the first for the description and price (the price could vary).

The solution (thanks to Emsoftware for telling me about it!) is to read the data into an array until I get to a new header:

- this creates an array, called bigArray, which contains all the lines that share a ProductHeader. The items on each line are separated by a pipe character.

Then XData is ready to start placing items on the page, but instead of using its fieldname, e.g. «ProductCode», you would tell is «item 1 of line ?? of bigArray», like this:

«put the number of lines in bigArray into numlines«item 1 of line 1 of bigArray» & tab & «item 2 of line 1 of bigArray»«repeat with i from 1 to numlines«item 3 of line i of bigArray» & tab «end repeat

This is a rather cobbled together explanation from a much longer prototype, with lots of added complications, but I hope it gives a flavour of the power of arrays. I expect to learn lots more ways of using them, now I'm aware of their existence!

My final prototype is well over a page long, and probably contains 90% logic, 10% actual elements going on the page! I've come a long way from «field1» «field2» «field3» !!

Customer has supplied price list in Excel. Each product is available in a range of sizes, and each product goes into a separate table. But they have listed them from largest to smallest, and on the printed price list they want it to go from smallest to largest.

Just read into an array, then place the data 'backwards':

«repeat with ctr = (the number of lines in bigArray) down to 1»«item 1 of line ctr of bigArray»..... etc«end repeat»