Index

Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

MergeTemplate – XpressDox

Creating packages / suites of documents

 

With the MergeTemplate function, it is possible to create many assembled documents from one interview. One template can use the MergeTemplate function to assemble a new document, or multiple MergeTemplate functions to assemble multiple new documents. It can even be used in a ForEach to assemble a document per repeater.

 

Syntax:

The argument to the function is the name of the template to be merged, which can be any one of the following:

  • a hard-coded name, in which case it must be in quotes: «MergeTemplate('Letter to Borrower')» or if you are using an alias, «MergeTemplate('letters:Letter to Borrower')»
  • the name of the template can be contained in a data element: «MergeTemplate(SelectedDocument)», and therefore no quotes would be required
  • the name can be constructed out of the contents of data elements and/or variables and/or constants: «MergeTemplate(concat('letters:Letter to ',PartyType))».

 

 

Examples:

Execution of the «MergeTemplate()» function can be conditional, as demonstrated below:

«If(IncludeSpouse = "Y")»
«MergeTemplate('Letter to Spouse')»
«End()»

In addition, any template referenced in a MergeTemplate() function can itself call MergeTemplate(). Any additional assembles will be merged, and saved, into their own separate file.

 

Using MergeTemplate in a repeater:

The following example would assemble the “Letter of Demand” to each of the Parties captured in the ForEach(Party).

«ForEach(Party)»
«CaptureDataElement(PartyName)»
«MergeTemplate(‘Letter of Demand’,’Party’,position())»
«End()»

 

Further information on filtering and naming repeated documents is provided here.

 

 

Some things to note when using MergeTemplate:

  1. The data elements from the MergeTemplate will not be included in the interview in the same way as IncludeTemplate would. This is because the name of the MergeTemplate could be made up of elements inside the interview itself, and therefore the template would be unknown to XpressDox at the time of building the interview. The template author needs to make provision for the data elements on the MergeTemplate using techniques such as CaptureDataElement or Define.
  2. Variables that you use on a template are not carried through to the MergeTemplate, it is considered an entirely separate assembly.