Use Google to find help fast. For example, search on "xpressdox choosefromlist".

ForEach: Handling repeating data

ForEach: Handling repeating data

The commands used to handle repeating data are the ForEach, List and Ordinal commands.

The term repeating data would apply, for example, to a list of parties to an agreement, or to a number of lines on an invoice. The central issue with repeating data is that the number of repeated items (data elements) is not known at the time the template is authored, and so XpressDox offers these commands as a way of processing a variable number of repeated data elements.

a. ForEach: An example, listing the surname and first names of a number of parties is:

The parties are:
<<ForEach( party)>>Surname: <<surname>>
First names: <<firstnames>>
<<End()>>

The output of this snippet would look like:

The parties are:
Surname: Potter
First names: Harry
Surname: Jones
First name: Juliet
Surname: Basset
First names: Fred

b. Sort: This is actually a subcommand of the ForEach command. For example, to sort the above list by surname, the ForEach would look like:

The parties are:
<<ForEach(party,surname,ascending,text)>>Surname: <<surname>>
First names: <<firstnames>>
<<End()>>

In this example the parties would be listed in ascending order of surname. The ‘ascending’ and ‘text’ are the order and data type respectively, and these values could in fact have been omitted in this example, as they are the defaults. The other option for order is ‘descending’, and the other option for data type is ‘number’.

The output of the snippet would now look like:

The parties are:
Surname: Basset
First names: Fred
Surname: Jones
First name: Juliet
Surname: Potter
First names: Harry

Leave a Reply