The RunTemplate function, a function which works in the web only, allows you to create a “package” of templates and run selected templates with separate interviews, one after the other. The product is a package of separate Word (and/or PDF) documents.
Command structure:
«RunTemplate('TemplateA.xdtpx')»
Usage example:
Consider the following example. Here are 4 templates, a “launching template” which collects data about which templates to assemble but does make a document, and then the 3 templates which will possibly be run depending on the user’s answers in the interview.
«Comment(collect data about which templates to run)»
«Comment(TemplateA)»
«ChooseFromHzRDBList(TemplateA,Yes,No)»
«Caption(TemplateA,Do you require Template A?)»
«if(TemplateA = ‘Yes’)»
«RunTemplate('TemplateA.xdtpx')»
«End(A)»
«Comment(TemplateB)»
«ChooseFromHzRDBList(TemplateB,Yes,No)»
«Caption(TemplateB,Do you require Template B?)»
«if(TemplateB = ‘Yes’)»
«RunTemplate('TemplateB.xdtpx')»
«End(B)»
«Comment(TemplateC)»
«ChooseFromHzRDBList(TemplateC,Yes,No)»
«Caption(TemplateC,Do you require Template C?)»
«if(TemplateC = ‘Yes’)»
«RunTemplate('TemplateC.xdtpx')»
«End(C)»
«Comment(The following command instructs XD to make only a data file from this template. And thereafter how to save that data file.)»
«SetInterviewDataOnly(Yes)»
«SetSavedDataFolder(.\Data)»
«SetSavedDataFileName(<ClientName>)»
And templates A, B, and C are as follows:
Notice how, when data elements are common between templates, those data element names are exactly the same. When the “launching template” is run the user will get this interview:
Depending on the choices made on this first interview screen, the user will then be presented with separate interviews for each of the selected templates.
Data captured in this interview will be populated into subsequent interviews when the data element names are the same.
Note:
This feature was built with our XD:Publisher product in mind and as such is only available on the web.