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

Document per Repeated Item

Document per Repeated Item

Suppose you have an application which requires that one or more parties sign a suretyship document, with the requirement that each party signs their own document, not that they all sign the same document.

The first thing to do is set up the suretyship template, with the relevant fixed text, etc., just like any other template.  Suppose the template reads something like this:

I, <<SuretyFirstNames>> <<SuretySurname>> (Born on <<FormatDate(SuretyDOB, “dd MMMM yyyy”)>>) hereby declare blah blah.
blah
Signed: <<SuretyFirstNames>> <<SuretySurname>>

Of course, this will only produce the information for one surety, and doesn’t indicate in any way that there can be more than one surety.

The normal way of indicating repeating data to XpressDox is the <<ForEach>> command, so it is tempting to try the following:

<<ForEach(Surety)>>I, <<SuretyFirstNames>> <<SuretySurname>> (Born on <<FormatDate(SuretyDOB, “dd MMMM yyyy”)>>) hereby declare blah blah.
blah
Signed: <<SuretyFirstNames>> <<SuretySurname>>
<<End()>>

The above is an example of how NOT to address this problem

But, of course, this will repeat the sureties’ information for all of the sureties one after the other on the same document.

If you had a single page document, you could use this to achieve something like the “Mail Merge” sample in the XpressDox sample templates.  But even that is not a very elegant solution.

However, the Document per Repeated Item feature means that you can qualify each of the Surety data elements with Surety[$SuretyNumber]/ (SuretyNumber in this context is called the Repeated Item Selector) then XpressDox will do the following:

  1. Infer that the Surety data element is a repeating parent data element.
  2. Put a field on the data capture interview to capture a value for a data element called SuretyNumber (i.e. the data element with a $ sign in front of it, called the Repeated Item Selector).
  3. Then, if the user running the template leaves the SuretyNumber field empty in the data capture interview, XpressDox will cycle the SuretyNumber through all the values from 1 to the number of sureties captured in the data capture interview.  And, for each value, it will merge a new document, merging in the Surety fields for the relevant value of $SuretyNumber.
  4. If the user types in a number into the SuretyNumber field, then XpressDox will prepare one merged document with the information for that specific Surety.

The sample snippet of template that we have been considering would then look like this:

I, <<Surety[$SuretyNumber]/SuretyFirstNames>> <<Surety[$SuretyNumber]/SuretySurname>> (Born on <<FormatDate(Surety[$SuretyNumber]/SuretyDOB, “dd MMMM yyyy”)>>) hereby declare blah blah.
blah
Signed: <<Surety[$SuretyNumber]/SuretyFirstNames>> <<Surety[$SuretyNumber]/SuretySurname>>

And the above snippet would be enough to invoke the Document per Repeated Item feature. Try it and see.

Also, have a look at the Sample template NorthwindInvoice(BasedOnNumericPositionOfOrder).xdtpl (in the My Document\XpressDox\Samples folder). That template has not been specially changed for this feature, but if you run the template, select a supplier and then (leaving the NumberOfRequiredOrder field empty on the interview), press OK, and notice how the Document per Repeated Item feature described here kicks in.

See the article Document per Repeated Item – with Filter which discusses using a filter narrow down the repeated items for which the separate documents will be prepared.

Leave a Reply