<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>XpressDox Document Assembly &#187; XpressDox Cookbook</title>
	<atom:link href="http://www.xpressdox.com/category/help/cookbook/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xpressdox.com</link>
	<description>Powerful and affordable document assembly</description>
	<lastBuildDate>Thu, 02 Feb 2012 15:03:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Understanding XpressDox Artefacts</title>
		<link>http://www.xpressdox.com/help/cookbook/xpressdox-artefacts/</link>
		<comments>http://www.xpressdox.com/help/cookbook/xpressdox-artefacts/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 12:01:59 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Help]]></category>
		<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[OptimizeParsing]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4813</guid>
		<description><![CDATA[When a template runs, XpressDox creates a number of internal structures.  The most important of these is an XSLT Stylesheet.  The stylesheet contains the definition of how the data from an XML data set are to be inserted into the Word template in order to generate the merged document.  The stylesheet is constructed entirely from [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/xpressdox-artefacts/" title="Permanent link to Understanding XpressDox Artefacts"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for Understanding XpressDox Artefacts" /></a>
</p><p>When a template runs, XpressDox creates a number of internal structures.  The most important of these is an XSLT Stylesheet.  The stylesheet contains the definition of how the data from an XML data set are to be inserted into the Word template in order to generate the merged document.  The stylesheet is constructed entirely from the contents of the XpressDox fillpoints in the template which is run (and in any templates included via <code>«IncludeTemplate()»</code> or <code>«BaseTemplate()»</code> commands).</p>
<p>The other important internal structure is the Schema.  This is created by XpressDox from the stylesheet.  The schema is used to construct the interview in the XpressDox desktop, and also in the browser version of XpressDox.</p>
<p>These internal structures are called “artefacts”, and for large templates the time taken to construct these artefacts can become unacceptably large.  And seeing that the artefacts will be exactly the same each time a template is run, it seems a pity to have to construct them each time.  For this reason XpressDox creates the artefacts only when the template is run for the first time, and after it (or any of its <em>Included </em>or <em>Base </em>templates) has changed.  The artefacts are stored in the “XDArtifacts” sub-folder of the template folder, with the same file name as the template, with the extension changing for each of the artefacts.  On the second and subsequent times that a template is run, instead of re-creating the artefacts, XpressDox reads them out of the XDArtifacts sub-folder. (The XDArtifacts folder is not shown in the XpressDox Explorer, as it would just create clutter).</p>
<p>In fact, on the second and subsequent runs of a template, the template file itself is not used by XpressDox, except that its time stamp is used to compare with the artefact’s time stamp to work out whether the template has changed since the time the artefact was created.</p>
<h3>Suppress artefact creation</h3>
<p>It might be that you (the template author) do not want the template artefacts created, for whatever reason (for small templates (less than about 10-20 pages) this will possibly not make a noticeable difference in execution time).  This can be achieved using the command <a title="The OptimizeParsing Command" href="http://www.xpressdox.com/help/reference/optimizeparsing/" target="_self">«OptimizeParsing(Off)»</a>.</p>
<h3>Restoring backups</h3>
<p>When restoring a backed up version of a template, care must be taken to take the artefacts into account.  This can be done by restoring the backup of the artefacts (in the XDArtifacts folder), or by deleting the artefacts for the restored file.</p>
<p>The reason that this care must be taken is that, for reasons of efficiency, the way that XpressDox determines whether a template has changed since the artefacts were created is by comparing the “Date Modified” of the template with the date modified of the artefact.  In the case where a template is restored from a backup, that template’s date modified is highly unlikely to be later than the artefact files, and so when the template is next run, its contents will be ignored and the artefacts will used to create the interview and to perform the merge.  But the artefacts in this case will have been created from a later version of the template, not the one that was restored, and so restoring the backup of the template on its own, without restoring the backed up version of the artefacts (or deleting the artefacts), will have no effect.</p>
<p>&nbsp;</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/xpressdox-artefacts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I know what the data element name is?</title>
		<link>http://www.xpressdox.com/help/cookbook/know-data-element-name/</link>
		<comments>http://www.xpressdox.com/help/cookbook/know-data-element-name/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 08:04:50 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[ChooseFromDataSource]]></category>
		<category><![CDATA[ChooseFromFile]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4657</guid>
		<description><![CDATA[In trouble shooting a template, you need to know the data element names.  Obviously. But looking at an interview, the data element names are not always obvious, especially if you have used &#60;&#60;Caption&#62;&#62;s. Another situation is with ChooseFromDataSource, and ChooseFromFile (and the Include&#8230; variants of those commands), where XpressDox generates a special data element name. [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/know-data-element-name/" title="Permanent link to How do I know what the data element name is?"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for How do I know what the data element name is?" /></a>
</p><p>In trouble shooting a template, you need to know the data element names.  Obviously.</p>
<p>But looking at an interview, the data element names are not always obvious, especially if you have used &lt;&lt;Caption&gt;&gt;s.</p>
<p>Another situation is with <a title="The ChooseFromDataSource Command" href="http://www.xpressdox.com/help/reference/choosefromdatasource/" target="_self">ChooseFromDataSource</a>, and <a title="You work for three bosses" href="http://www.xpressdox.com/help/cookbook/you-work-for-three-bosses/" target="_self">ChooseFromFile</a> (and the <em>Include</em>&#8230; variants of those commands), where XpressDox generates a special data element name.</p>
<p>The way to find out what the data element name of any control on the interview is, is as follows:</p>
<ol>
<li>Put the cursor into the control in question.</li>
<li>Press &lt;Ctrl&gt; and &lt;Alt&gt; together.</li>
</ol>
<p>The name of the data element (and also any condition applying to it) will be shown in the Help area at the bottom of the interview form.</p>
<p>&nbsp;</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/' rel='bookmark' title='Trouble shooting Conditional Capture'>Trouble shooting Conditional Capture</a></li>
<li><a href='http://www.xpressdox.com/help/reference/standard-data-elements/' rel='bookmark' title='Standard data element configuration'>Standard data element configuration</a></li>
<li><a href='http://www.xpressdox.com/help/reference/other-advanced-features/' rel='bookmark' title='Getting data from data sources into a template'>Getting data from data sources into a template</a></li>
<li><a href='http://www.xpressdox.com/help/reference/data-capture/' rel='bookmark' title='Data capture in XpressDox'>Data capture in XpressDox</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/laying-out-data-capture/' rel='bookmark' title='Laying out the data capture interview'>Laying out the data capture interview</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/know-data-element-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with LinkToDataSource</title>
		<link>http://www.xpressdox.com/help/cookbook/working-linktodatasource-1/</link>
		<comments>http://www.xpressdox.com/help/cookbook/working-linktodatasource-1/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 19:45:15 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[ChooseFromDataSource]]></category>
		<category><![CDATA[LinkToDataSource]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4639</guid>
		<description><![CDATA[Working with LinkToDataSource – example with a highly normalised data base. You need to access a database which has the following structure: Table “Contact” ContactFirstName ContactLastName ContactTitle Address City Region ContactTypeId Table “ContactType” TypeId TypeDescription TypeCode You can see that the actual value of TypeDescription is not kept in the Contact table, but a link [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/working-linktodatasource-1/" title="Permanent link to Working with LinkToDataSource"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for Working with LinkToDataSource" /></a>
</p><p>Working with LinkToDataSource – example with a highly normalised data base.</p>
<p>You need to access a database which has the following structure:</p>
<p>Table “Contact”<br />
ContactFirstName<br />
ContactLastName<br />
ContactTitle<br />
Address<br />
City<br />
Region<br />
ContactTypeId</p>
<p>Table “ContactType”<br />
TypeId<br />
TypeDescription<br />
TypeCode</p>
<p>You can see that the actual value of <em>TypeDescription </em>is not kept in the <em>Contact </em>table, but a link to it is kept in the <em>Contact </em>table via the column <em>ContactTypeId</em> which corresponds with the <em>TypeId </em>column in the <em>ContactType </em>table.</p>
<p>Now, there is some text in the template that looks something like:</p>
<blockquote><p>Dear <code>&lt;&lt;ContactTitle&gt;&gt;</code> <code>&lt;&lt;ContactLastName&gt;&gt;</code></p>
<p>We will take pleasure in meeting with you on <code>&lt;&lt;FormatDate(AppointmentDate,'MMMM d, yyyy')&gt;&gt;</code> to conclude our contract.</p>
<p><code>&lt;&lt;If(TypeCode = “CUST”)&gt;&gt;</code>Please make sure you bring your FICA details.<code>&lt;&lt;End()&gt;&gt;</code></p>
<p>…</p></blockquote>
<p>It is clear that we would need to configure a data source to access the <em>Contact</em> table.  Suppose this is done and the data source is called “Contacts”.  We could then put a <a title="Other advanced featrues in XpressDox" href="http://www.xpressdox.com/help/reference/other-advanced-features/" target="_self">ChooseFromDataSource</a> command in the template, expanding the above snippet to something like:</p>
<blockquote><p><code>&lt;&lt;ChooseFromDataSource(Contacts,Enter the contact Id or press the button on the right,RefreshSave)&gt;&gt;</code></p>
<p>Dear <code>&lt;&lt;ContactTitle&gt;&gt;</code> <code>&lt;&lt;ContactLastName&gt;&gt;</code></p>
<p>We will take pleasure in meeting with you on <code>&lt;&lt;FormatDate(AppointmentDate,'MMMM d, yyyy')&gt;&gt;</code> to conclude our contract.</p>
<p><code>&lt;&lt;If(TypeCode = “CUST”)&gt;&gt;</code>Please make sure you bring your FICA details.<code>&lt;&lt;End()&gt;&gt;</code></p>
<p>…</p></blockquote>
<p>The issue then is how to get hold of the <em>ContactType</em> information (so that the test for <em>TypeCode</em> will work correctly).  One way would be to configure the <em>ContactType</em> table as a sub-collection of the <em>Contact</em> table in the <em>Contacts</em> data source (you can see an example of this in the configuration of the <em>Northwind CustomerOrder</em> data source in the My Documents\XpressDox\Samples folder).  The problem with this is that, although it would work, it would make it appear that each row in a <em>Contact</em> table has multiple <em>ContactTypes</em>, which is not the case.</p>
<p>Another approach would be to go about it in this way:</p>
<ol>
<li>In addition to the <em>Contacts</em> data source defined above, define a <em>ContactTypes </em>data source, referencing the <em>ContactType</em> table, with an Id which is the <em>TypeId</em> column (fairly obvious).</li>
<li>Now we need to select a kind of “trigger field” in the interview which will trigger the reading of that <em>ContactTypes</em> data source.  A good candidate is the <em>AppointmentDate</em> data element, as it will appear in the interview after the fields referencing the <em>Contacts</em> data source.  This is good, because when the Contacts data source is read, the data element <em>ContactTypeId</em> will be read from the Contacts data source, and it is the value of this <em>ContactTypeId</em> data element which is needed as the Id to retrieve the <em>ContactType</em> information.</li>
<li>Then, use the following command:<code>&lt;&lt;LinkToDataSource(AppointmentDate,ContactTypes,,Id=&lt;ContactTypeId&gt;)&gt;&gt;</code></li>
<p><code> </code></ol>
<p>What will happen, then, is that when the user enters the <em>AppointmentDate</em> and moves the focus out of that <em>AppointmentDate</em> field in the interview, XpressDox will read the <em>ContactTypes</em> data source, using the value of the <em>ContactTypeId</em> data element as the Id, and retrieve the relevant row from the <em>ContactType</em> table.  This will populate the <em>TypeCode</em> data element, and so the test against it will have the correct values to test against.</p>
<p>The reason for the Id=&lt;ContactTypeId&gt; parameter is that by default, when a <em>LinkToDataSource</em> command is executed, if the <em>Id=</em> parameter is missing, then the value of the data element in the command is used as the Id of the linked data source – and in this example, <em>AppointmentDate</em> is that data element, and obviously is NOT the Id of the <em>ContactTypes</em> data source.</p>
<h3>Why not link to the ChooseFromDataSource?</h3>
<p>In fact, there is no reason why not to link the <em>ContactTypes </em>data source to the data element of the <em>ChooseFromDataSource </em>command.  Then the Contact Type information would be read &#8220;at the same time&#8221; as the <em>Contact</em> was chosen &#8211; or at least immediately after the <em>Contact </em>is chosen.  The question is &#8211; what is the name of that data element?  Because the command <em>ChooseFromDataSource </em>doesn&#8217;t specify a data element name, only a data source name.  But in fact, for each <em>ChooseFromDataSource </em>command, XpressDox generates a dummy data element with name &#8216;XD&#8217; followed by the data source name.  So in this case the data element name is &#8216;XDContacts&#8217;.  The ideal version of the above snippet would then be:</p>
<blockquote><p><code>&lt;&lt;ChooseFromDataSource(Contacts,Enter the contact Id or press the button on the right,RefreshSave)&gt;&gt;</code><br />
<code>&lt;&lt;LinkToDataSource(XDContacts,ContactTypes,,Id=&lt;ContactTypeId&gt;)&gt;&gt;</code><br />
Dear <code>&lt;&lt;ContactTitle&gt;&gt;</code> <code>&lt;&lt;ContactLastName&gt;&gt;</code></p>
<p>We will take pleasure in meeting with you on <code>&lt;&lt;FormatDate(AppointmentDate,'MMMM d, yyyy')&gt;&gt;</code> to conclude our contract.</p>
<p><code>&lt;&lt;If(TypeCode = “CUST”)&gt;&gt;</code>Please make sure you bring your FICA details.<code>&lt;&lt;End()&gt;&gt;</code></p>
<p>…</p></blockquote>
<h3>What about other linked database tables?</h3>
<p>In practice, databases which are normalised as in this example will have numerous tables linked via &#8220;id&#8221; columns to the main Contact table.  For example, the contact may have a home address, business address, postal address, billing address, etc.  And in this kind of database, there would be a separate table &#8220;Address&#8221; containing only addresses, and in the Contact table, instead of there being columns containing the addresses themselves, there will be columns like &#8220;HomeAddressId&#8221;, &#8220;BusinessAddressId&#8221;, etc.<br />
The way to handle this would be to configure a separate data source for each of the different address types, and use the configuration mapping feature to name the data elements uniquely &#8211; i.e. all the Home Address data elements would start with &#8220;Home&#8221;, all the Business Address elements would start with &#8220;Bus&#8221;, etc.<br />
Then, if in a specific template you required the contact details as well as the business and postal address details (but not home address), then you would have a <em>ChooseFromDataSource </em>command to enable the user to select the contact, and then one <em>LinkToDataSource </em>command for the business address data source, and one <em>LinkToDataSource </em>command for the postal address details, something like this:</p>
<blockquote><p><code>&lt;&lt;ChooseFromDataSource(Contacts,Select the contact)&gt;&gt;</code></p>
<p><code>&lt;&lt;LinkToDataSource(XDContacts,BusinessAddresses,,id=&lt;BusinessAddressId&gt;)&gt;&gt;<br />
&lt;&lt;LinkToDataSource(XDContacts,PostalAddresses,,id=&lt;PostalAddressId&gt;)&gt;&gt;</code></p></blockquote>
<p>&nbsp;</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/reference/choosefromdatasource/' rel='bookmark' title='The ChooseFromDataSource Command'>The ChooseFromDataSource Command</a></li>
<li><a href='http://www.xpressdox.com/help/reference/linktodatasource/' rel='bookmark' title='The LinkToDataSource Command'>The LinkToDataSource Command</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-9-1/' rel='bookmark' title='Version 3.9.1 (2011-07-07)'>Version 3.9.1 (2011-07-07)</a></li>
<li><a href='http://www.xpressdox.com/help/reference/configuring-data-sources/' rel='bookmark' title='Configuring data sources'>Configuring data sources</a></li>
<li><a href='http://www.xpressdox.com/help/reference/other-advanced-features/' rel='bookmark' title='Getting data from data sources into a template'>Getting data from data sources into a template</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/working-linktodatasource-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Server: Integration and URL Structure</title>
		<link>http://www.xpressdox.com/help/cookbook/integrating-templates/</link>
		<comments>http://www.xpressdox.com/help/cookbook/integrating-templates/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 13:45:37 +0000</pubDate>
		<dc:creator>Charl</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4507</guid>
		<description><![CDATA[Here are the technical instructions to construct the relevant URLs required to integrate the power of XpressDox Document Assembly into you own web sites or web applications. Before you can run your first web based template, you will need: the XpressDox Desktop, the application used to author your XpressDox templates. This can be downloaded from [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Here are the technical instructions to construct the relevant URLs required to integrate the power of XpressDox Document Assembly into you own web sites or web applications.</p>
<ol>
<li>Before you can run your first web based template, you will need:</li>
<ol type="a">
<li>the XpressDox Desktop, the application used to author your XpressDox templates. This can be downloaded from <a title="Start Free Trial" href="http://www.xpressdox.com/download/">http://www.xpressdox.com/download/</a>.</li>
<li>your XpressDox Web Server registration email containing your <strong>Username</strong>, <strong>Password</strong> and <strong>Unique Account Code</strong>. If you do not yet have an account, register at <a title="Web Server Registration" href="http://www.xpressdox.com/serverregistration/">http://www.xpressdox.com/serverregistration/</a>.</li>
</ol>
<li>To run your first web based XpressDox template, you need:</li>
<ol type="a">
<li>an XpressDox template.</li>
<li>upload your template to the Server by logging in to the XpressDox Server Manager application, using your Username and Password, from the XpressDox ribbon in Word (XpressDox Ribbon > Settings > Server).</li>
</ol>
<p class="note">Your template is now in the cloud and ready to be integrated into your website and business process.</p>
<li>To integrate your template in your web site or web application, you need:</li>
<ol type="a">
<li>using the Server Manager, generate the unique URL that will point to the template by clicking the <em>Generate URL</em> button. The structure of this URL is described in detail below.</li>
<li>on your web page that the interview is to be displayed, create an iframe and set the <code>src</code> attribute to the URL described below.</li>
<li>the user completes the interview form and clicks <em>Submit</em>.</li>
<li>a document will be generated by the XpressDox Server and the user will be redirected to the <em>Return URL</em> specified in the original template URL.</li>
<li>the <em>Return URL</em> will point to a page on your site where you can control what the user is able to do with the generated document. For example, this could be a simple <em>Thank You</em> page, a <em>Download</em> page, or a link embedded in a particular process.</li>
</ol>
<li>The structure of the URL required to integrate your template into you site is as follows:</li>
<ol type="a">
<li>the Server Manager is used to generate these URLs.<br />
<code>http://server.xpressdox.com/XpressDoxServer/Pages/XpressDoxInterview.aspx?templateIDs=[TEMPLATEIDS]&#038;redirectURL=[THE_URL_REDIRECTED_TO_AFTER_DOCUMENT_ASSEMBLED]&#038;[extraParam1]=[SOMEINFO]&#038;[extraParam2]=[SOMEMOREINFO]</code></li>
<p>The parameters explained:</p>
<ol type="i">
<li><code>TEMPLATEIDS</code>. This is the <em>Unique Template Code</em> used to identify the web based template. Multiple templates can be run in a single call. To do this, separate the relevant template codes with the pipe character: <code>|</code>.</li>
<li><code>THE_URL_REDIRECTED_TO_AFTER_DOCUMENT_ASSEMBLED</code>. The URL to redirect back to once the document has been generated. The redirect URL structure is detailed below.</li>
<li><code>extraParam1=SOMEINFO</code>. You can include any number of additional parameters in the posted URL. All additional parameters passed will be included in the returned URL. This is to allow your site to retain any context that may be important to you.</li>
</ol>
<li>Below is the structure of the URL that the iframe is redirected to on completion of the documents&mdash;the <em>Return URL</em>:<br />
<code>http://[THE_URL_REDIRECTED_TO_AFTER_DOCUMENT_ASSEMBLED]?usageIDs=[USAGEID]|[DOCUMENT_NAME]&#038;[extraParam1]=[SOMEINFO]&#038;[extraParam2]=[SOMEMOREINFO]</code></li>
<p>The parameters explained:</p>
<ol type="i">
<li><code>THE_URL_REDIRECTED_TO_AFTER_DOCUMENT_ASSEMBLED</code>. The URL that is redirected back to once the document has been generated.</li>
<li><code>USAGEID</code>. The <em>Unique Usage Code</em> for a generated document.</li>
<li><code>DOCUMENT_NAME</code>. The display name of the generated document.</li>
<li>UsageID and Document Name are separated by the pipe character: <code>|</code>. In the event that multiple documents are generated, the UsageID|DocumentName items will be further separated by the caret character: <code>^</code>.</li>
<li><code>extraParam1=SOMEINFO</code>. All your additional parameters passed with the initial template URL. You can now use this data to retain any context that may be important to you or your user.</li>
</ol>
<li>Below is the structure of the URL used to download assembled files from the server, either Microsoft&reg; Office Word files (.doc), PDF files (.pdf), or Data files (.xml):<br />
<code>http://server.xpressdox.com/XpressDoxServer/Pages/download.aspx?usageID=[USAGEID]&#038;fileType=[TYPE_OF_FILE]</code></li>
<p>The parameters explained:</p>
<ol type="i">
<li><code>USAGEID</code>. The Unique Usage Code for the generated document as returned in the return URL discussed above.</li>
<li><code>TYPE_OF_FILE</code>. The type of file you want to download for the identified assembly. Each assembly can generate three possible files:</li>
<ul>
<li>MS WORD Document (Set fileType to ‘doc’)</li>
<li>PDF Document (Set fileType to ‘pdf’)</li>
<li>XML Data File (Set fileType to ‘xml’)</li>
</ul>
</ol>
</ol>
</ol>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/sql-server-data-source/' rel='bookmark' title='Use a SQL Server Data Source to include Customer information on a template'>Use a SQL Server Data Source to include Customer information on a template</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/integrating-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HotDocs to XpressDox syntax conversion</title>
		<link>http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/</link>
		<comments>http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 15:17:03 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[convert template]]></category>
		<category><![CDATA[hotdocs]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4460</guid>
		<description><![CDATA[The XpressDox template conversion utility introduced here can convert certain HotDocs fields to XpressDox fields, not just by replacing field delimiters, but in addition by translating the HotDocs syntax to XpressDox syntax. Because both XpressDox and HotDocs have a very large vocabulary of commands and functions, the one-to-one conversion of one to the other is [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/" title="Permanent link to HotDocs to XpressDox syntax conversion"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for HotDocs to XpressDox syntax conversion" /></a>
</p><p>The XpressDox template conversion utility introduced <a title="HotDocs to XpressDox template conversion" href="http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/" target="_self">here</a> can convert certain HotDocs fields to XpressDox fields, not just by replacing field delimiters, but in addition by translating the HotDocs syntax to XpressDox syntax.</p>
<p>Because both XpressDox and HotDocs have a very large vocabulary of commands and functions, the one-to-one conversion of one to the other is not possible in all circumstances.  A rule of thumb is that the more effort put into using the advanced features of HotDocs, the less likely it is that the conversion to XpressDox syntax will be successful.  In fact, XpressDox handles some situations (for example data bases and lookup lists in files) in radically different ways to those employed by other document assembly systems, so that appropriate migration to XpressDox will require some re-design.</p>
<p>However, the syntax converter will attempt at least to produce an XpressDox template that runs directly on being converted, if at all possible.</p>
<p>One feature that requires some initial consideration is that of boolean values  &#8211; i.e. true or false values.  XpressDox uses XML data, and all XML data values are manifested as strings.  Thus, a HotDocs construct like «IF OPTION1» &#8230;   «END IF» needs to become something like &lt;&lt;If(OPTION1 = &#8216;Y&#8217;)&gt;&gt; &#8230; &lt;&lt;End()&gt;&gt;.  The template author will need to make a decision in advance as to what convention they will use for this (for example, will they be coding XpressDox <em>Choose</em> commands like &lt;&lt;ChooseUsingCheckBox(Option,Y,N)&gt;&gt; or &lt;&lt;ChooseUsingCheckBox(Option,T,F)&gt;&gt; or &lt;&lt;ChooseFromRDBList(PersonIsMale,Yes,No)&gt;&gt;)  The syntax converter will provide this kind of conversion, but can only do the conversion if it has been provided with the string values for True and False which will be used in the converted XpressDox templates.  That is why the two places where syntax conversion can be selected (see below) have an area where the &#8220;true&#8221; and &#8220;false&#8221; values are supplied.</p>
<p>Syntax conversion can be performed either on a per-document basis (using the &#8220;Convert Current Document&#8217;s Fields&#8221; feature in the first tab of the Template Author Utilities) , or else on all the documents in a folder (using the &#8220;Configure and Convert Delimiters&#8221; tab as described <a title="HotDocs to XpressDox template conversion" href="http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/" target="_self">here</a>).</p>
<p>When doing a per-document conversion, then the <em>Replace field delimiters(Non-Interactive Conversion)</em> option must be chosen, and then the <em>Replace delimiters and Convert syntax</em> option.</p>
<p class="note">Note that you can select to use as the XpressDox field delimiters the &#8220;chevrons&#8221; that HotDocs uses (i.e. they are chosen as the <em>Authoring Delimiters</em> in the &#8220;Configure and Convert Delimiters&#8221; tab of the Template Author Utilities).  In this case the <em>Replace field delimiters</em> option must still be chosen, even though, strictly speaking, the delimiters will not be replaced.</p>
<p>During the process of performing the conversion, the following conventions apply:</p>
<ol>
<li>A HotDocs variable name is converted to an XpressDox data element name by translating all non-XML characters in the HotDocs variable name to &#8216;_&#8217; (underscore).</li>
<li>A best attempt at translating the various HotDocs constructs is made.</li>
<li>In appropriate places, a &lt;&lt;ChooseUsingCheckBox()&gt;&gt; command is generated in the document (and colored red as discussed below).</li>
<li>The resulting XpressDox fields are colored red, orange and blue to indicate the degree of certainty with which the translation can be regarded.  Red is least certain, and blue most.</li>
<li>The red and orange fields have the original HotDocs field following them in a specially coded XpressDox comment field.</li>
</ol>
<p>After the conversion has been done, the results need to be examined by the template author to ensure that the translation has produced a template that conforms with the system they have designed.  In the simplest case, where all the fields contain only HotDocs variables,  then the conversion will be adequate as-is.  But as soon as other HotDocs constructs have been used, the resulting templates should be examined.</p>
<p>The &#8220;Convert Current Document&#8217;s Fields&#8221; tab has three buttons that assist with this &#8211; they are the three on the right colored red, orange and green.  The first two will locate the relevant colored XpressDox field, and those fields can then be examined and changed, if necessary.  The green button will remove all the comments which have been generated by the converter which contain the original HotDocs field.</p>
<p><img class="aligncenter" src="http://www.xpressdox.com/images/bc/screen/convert-current-documents-fields.jpg" alt="Convert Current Document Fields" /></p>
<p class="alert">It is recommended that the &#8220;Delete Comments&#8221; function is performed on all templates produced with syntax conversion, as in some cases the resulting XpressDox template will not run with those comments in place.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/' rel='bookmark' title='Version 3.5.0 (2011-03-04)'>Version 3.5.0 (2011-03-04)</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-7-0/' rel='bookmark' title='Version 3.7.0 (2011-04-18)'>Version 3.7.0 (2011-04-18)</a></li>
<li><a href='http://www.xpressdox.com/help/reference/syntax-notes/' rel='bookmark' title='Notes on XpressDox syntax'>Notes on XpressDox syntax</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-5-0/' rel='bookmark' title='Version 3.5.0 (2011-03-04)'>Version 3.5.0 (2011-03-04)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Version 3.5.0 (2011-03-04)</title>
		<link>http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/</link>
		<comments>http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 11:52:48 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[contractexpress]]></category>
		<category><![CDATA[convert template]]></category>
		<category><![CDATA[field delimeter]]></category>
		<category><![CDATA[ghostfill]]></category>
		<category><![CDATA[hotdocs]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=4049</guid>
		<description><![CDATA[Templates authored in HotDocs®, GhostFill®, ContractExpress® and other document assembly systems can, with varying degrees of certainty, be converted to run successfully with XpressDox. Why this works In principle, almost any delimiters can be used by XpressDox as fillpoint delimiters. For historic reasons, the &#60;&#60; and &#62;&#62; pair were chosen as the default, and all [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/" title="Permanent link to Version 3.5.0 (2011-03-04)"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Converting HotDocs and GhostFill templates for use with XpressDox" /></a>
</p><p>Templates authored in HotDocs®, GhostFill®, ContractExpress® and other document assembly systems can, with varying degrees of certainty, be converted to run successfully with XpressDox.</p>
<h3>Why this works</h3>
<p>In principle, almost any delimiters can be used by XpressDox as fillpoint delimiters. For historic reasons, the &lt;&lt; and &gt;&gt; pair were chosen as the default, and all the XpressDox documentation and sample templates use those as the fillpoin delimiters. A fundamental design principle of XpressDox, however, was that the <em>user should be allowed to choose</em> his or her own delimiters.</p>
<p>The delimiters need to be chosen carefully, so that they are unambiguously interpreted by XpressDox as delimiters. An obviously bad choice would be to use &#8221; and &#8221; as the delimiters. The &lt;&lt; and &gt;&gt; pair is a good choice as it is unlikely that these will be used in normal text inside a document. Correctly chosen, delimiters consisting of two characters (for example *{ and }*) will be less likely to occur naturally in a document than a single character (for example { and }) would be, and hence would be a good choice. Another good choice would be single characters which are unlikely to occur in normal usage, such as « and ».</p>
<p>Once you have decided on your choice of delimiters, if they are not the default XpressDox delimiters, then this choice needs to be registered with XpressDox so that the authoring tools (such as the Command Editor) use that pair of delimiters rather than the default XpressDox delimiters. This is done by using the <em>Template Author Utilities</em> in the ribbon or toolbar. The Template Author Utilities form consists of a number of tabs, and the first section in the <em>Configure and Convert Delimiters</em> tab gives access to the feature that allows you to choose your own delimiters. The delimiters thus configured are referred to as the Authoring Delimiters.</p>
<p>An important, and powerful, feature of XpressDox is that regardless of what authoring delimiters are decided on in the end, the XpressDox engine will always recognise a template which uses the following pairs of delimiters:</p>
<ul>
<li>The default XpressDox delimiters &lt;&lt; and &gt;&gt;</li>
<li>« and » (which are used in HotDocs templates)</li>
<li>%[ and ] (which are the GhostFill delimiters)</li>
<li>{ and } (which are used by ContractExpress and other document assembly systems)</li>
</ul>
<p>These sets of delimiters are called <em>XpressDox Native Delimiters</em>.</p>
<p>The algorithm that XpressDox uses when interpreting a template is to first look for the authoring delimiters (which might be something like *( and )* if that&#8217;s what you&#8217;ve chosen, or might be any of the pairs of native delimiters), and if the template contains no fillpoints with those delimiters then it goes on to look for the next set in the list of native delimiters. Once it finds at least one fillpoint for a given pair of delimiters, it then settles on that pair as the delimiters for that template and <em>any</em> templates included via <code>BaseTemplate</code>, <code>IncludeTemplate</code>, <code>InsertTemplate</code> or <code>MergeTemplate</code>.</p>
<p>An effect of the above algorithm is that if a template authored for HotDocs, GhostFill, ContractExpress, or any system using one of the sets of native delimiters, has only &#8220;simple&#8221; fillpoins—that is the fields consist of variable names only within delimiters—then XpressDox can run that template without the need to make any changes to the content of the template. All that would be needed is to save that template as an XpressDox template in Microsoft® Office Word 2003 XML format, and run it.</p>
<p class="alert">Please note: the variable names in a simple template described above need to be valid XML element names, which will always be the case in some document assembly systems, but in particular might not be the case with HotDocs templates, where spaces are allowed in variable names.</p>
<p>If a foreign template contains fillpoints which are not simple, containing formatting instructions or conditional assembly or repeating instructions for example, then the syntax of those fillpoints needs to be changed to conform to XpressDox command syntax. When foreign templates have used many such fairly complex structures, the conversion process can be quite onerous. To assist with that, the Template Author Utilities <em>Convert Current Document&#8217;s Fields</em> has some powerful features which will make this onerous task less so. This feature is discussed later in this article.</p>
<p class="note">Note on choosing your own delimiters: if you choose delimiters other than any of the native delimiters, then other users will not be able to run templates authored with those non-native delimiters unless they also register those delimiters on their system as the authoring delimiters. If those users are also advanced template authors then they can use the same process as described above, using the Template Author&#8217;s Utilities. However, you can ensure that all users get the same definition for the non-native authoring delimiters by ensuring that the file on your system with the path <em>&lt;Program Files Folder&gt;\o2Smart\XpressDox\WordAddin\SiteSettings.xml</em> is installed in the same path for all other users of your templates which have non-native delimiters. (For Word 2003, the above path is <em>&lt;Program Files Folder&gt;\o2Smart\XpressDox\VSTO2003\SiteSettings.xml</em>)</p>
<h3>Save the converted template in XpressDox format</h3>
<p>In order for a document to be run as a template by XpressDox, it must be saved as an XpressDox template. Typically, foreign templates will be in .doc or .dot or .rtf format, whereas XpressDox templates must be in Word 2003 XML format. Saving a document as an XpressDox template can be done in one of two ways:</p>
<ol>
<li>Open the template in Word, and save it using the XpressDox <em>Save as XpressDox Template</em> button in the ribbon or toolbar</li>
<li>Convert an entire folder of documents as follows:
<ol type="a">
<li>Load the XpressDox <em>Template Author Utilities</em> using the button on the ribbon or toolbar.</li>
<li>Choose the <em>Configure and Convert Delimiters</em> tab on the screen that appears. The screen will look like this:<br />
<img class="aligncenter" src="http://www.xpressdox.com/images/bc/screen/configure-convert-delimiters.jpg" alt="Configure and convert delimeters" /></li>
<li>The second part of that tab is the area where you can designate an entire folder of foreign templates to be saved in XpressDox template format. Choose the folder either by typing in the path or using the <em>Browse</em> button.</li>
<li>Optionally select the fillpoint delimiters that are on the existing foreign templates (which will be converted to the current <em>Authoring Delimiters</em>, as discussed above, and which are displayed for your information on the conversion form).</li>
<li>If you have chosen to convert text  (field) delimiters, then the converter will also, if required, convert the syntax within the delimiters from HotDocs syntax to XpressDox syntax.  If this is required, then check the checkbox labelled &#8220;Replace delimiters and Convert syntax (first pass). (Please read the article <a title="HotDocs to XpressDox syntax conversion" href="http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/" target="_self">HotDocs to XpressDox syntax conversion</a> for more details on syntax conversion).<br />
XpressDox, unlike other document assembly systems, does not have the concept of a data element containing a boolean (i.e. true/false) value (this is because the data used by XpressDox are XML, and XML supports only string value).  This means that constructs like «IF OPTION1»   «END IF» in HotDocs need to be translated into something like &lt;&lt;If(OPTION1 = &#8216;Y&#8217;)&gt;&gt;  &lt;&lt;End()&gt;&gt; in XpressDox.  The syntax converter will perform this translation, but needs to be given the &#8220;true&#8221; and &#8220;false&#8221; values that should be used, and hence the need to provide these in the converter&#8217;s screen.</li>
<li>Pressing <em>Convert </em>will cause all the Microsoft® Word documents in the provided folder to be converted to XpressDox templates.</li>
</ol>
</li>
</ol>
<h3>Converting complex templates</h3>
<p>In principle, there is a common set of features that various document assembly systems offer in order to automate the production of standard documents. However, that does not mean that there is necessarily a one-to-one correspondence between features in one system and similar features in another. This means that converting a template from, say HotDocs to XpressDox is not a simple matter of changing fillpoint delimiters. In any case, as discussed above, XpressDox will work natively with a template marked up with HotDocs delimiters. It is not just delimiters that may need to change, but the content of the fillpoints and sometimes even the basic design of the template and its commands.</p>
<p>The XpressDox utility for converting complex templates is found in the XpressDox <em>Template Author&#8217;s Utilities</em>, in the first tab called <em>Convert Current Document&#8217;s Fields</em>. The form with this tab visible looks like this:<br />
<img class="aligncenter" src="http://www.xpressdox.com/images/bc/screen/convert-current-document-complex-fields.jpg" alt="Convert current document fields" /></p>
<p>The following steps are appropriate:</p>
<ol>
<li>Load the document (foreign template) to be converted, into Word.</li>
<li>Load the template converter above.</li>
<li>Notice that there are a number of situations handled:
<ol type="a">
<li>The foreign template contains Word Fillpoints, and these are to be converted to XpressDox fillpoints.</li>
<li>The foreign fillpoints use text delimiters, such as those used by HotDocs, GhostFill or other document assembly systems.</li>
<li>&#8220;Copy-and-paste&#8221; document assembly where a user has marked up a template with codes such as &#8220;****&#8221; and just uses copy-and-paste (or find-and-replace).</li>
</ol>
</li>
<li>Choose the delimiters that are required.</li>
<li>Because this discussion is about complex templates, the check-box &#8220;Replace field delimiters only (Simple Conversion)&#8221; is not appropriate here.</li>
<li>Once the Convert button is pressed, then the converter takes each foreign field in turn and presents the contents (stripped of delimiters) in the &#8220;Existing field&#8221; text box. At the same time, the converter fills the &#8220;XpressDox field&#8221; drop-down box with samples of what might be used as data element names.
<ol type="a">
<li>You can choose from the drop down list, or edit the XpressDox field.</li>
<li>If you choose one of the choices in the &#8220;Common Commands and Functions&#8221; list, then the converter will take the data element name that is now in the XpressDox field and insert it into the correct place in the chosen command/function.</li>
<li>Suppose in the previous step you choose a FormatDate or FormatNumber but don&#8217;t like the format that is provided. You can change that format, and then copy-and-paste it into the Snippets area. Then, in a later field, you can choose that format specifier in the Snippets drop-down and then paste it into the &#8220;XpressDox field&#8221;. In other words, the Snippets area gives you a place to store frequently used snippets of text to be copied into commands at a later stage of the conversion. Even into future documents to be converted.</li>
<li>Once you like the contents of the &#8220;XpressDox field&#8221;, press the Accept button, and the converter goes on to the next field in the foreign template.</li>
</ol>
</li>
<li>The converter stores all the &#8220;Existing field&#8221; values as well as the resulting &#8220;XpressDox field&#8221; in a sort of &#8220;translation dictionary&#8221;. It stores that dictionary into the folder where the foreign template resides. Thereafter, whenever it encounters a field in a foreign template during conversion, it looks up the field contents in the dictionary, and presents as a default the corresponding XpressDox field in the &#8220;XpressDox field&#8221; on the conversion form. This means that after a few templates in a suite have been converted, as long as the original template author was consistent in the naming of variables (now data elements in XpressDox) and conditional commands, etc., then the conversion of templates becomes a question of inspecting the choice suggested for the conversion of a fillpoint, and pressing the Accept button over and over again.</li>
<li>Once a template has been converted, it must be saved as an XpressDox template (with the Save button on the ribbon or toolbar).</li>
</ol>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/hotdocs-syntax-conversion/' rel='bookmark' title='HotDocs to XpressDox syntax conversion'>HotDocs to XpressDox syntax conversion</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-5-0/' rel='bookmark' title='Version 3.5.0 (2011-03-04)'>Version 3.5.0 (2011-03-04)</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-7-0/' rel='bookmark' title='Version 3.7.0 (2011-04-18)'>Version 3.7.0 (2011-04-18)</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-6-0/' rel='bookmark' title='Version 3.6.0 (2011-03-31)'>Version 3.6.0 (2011-03-31)</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-3-8-1/' rel='bookmark' title='Version 3.8.1 (2011-06-07)'>Version 3.8.1 (2011-06-07)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/hotdocs-xpressdox-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select templates using a master template</title>
		<link>http://www.xpressdox.com/help/cookbook/master-template/</link>
		<comments>http://www.xpressdox.com/help/cookbook/master-template/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 11:47:10 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[InsertDocument]]></category>
		<category><![CDATA[MergeTemplate]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=3841</guid>
		<description><![CDATA[Selection of multiple templates to be run can be done by the user using the XpressDox explorer, but the template author can also control the selection of templates using a master template with document-selection logic built into it.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/master-template/" title="Permanent link to Select templates using a master template"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for Select templates using a master template" /></a>
</p><p>You have an application which requires a fairly large number of templates to be merged, but you do not want the user to have to choose the correct templates to run using the XpressDox Explorer, you rather want to use document assembly commands to select the templates to be run depending on data or user choices.</p>
<p>You could use the <a title="The RunTemplates Command" href="http://www.xpressdox.com/help/reference/runtemplates/" target="_self">RunTemplates</a> command, which is fine if you know beforehand which templates should be run.  The &lt;&lt;RunTemplates()&gt;&gt; command will also present an interview for each template in its list.  This might be what you want, but if you want to be able to select the templates to be run depending on data captured, then RunTemplates is not what is required.</p>
<p>The <a title="The MergeTemplate Command" href="http://www.xpressdox.com/help/reference/mergetemplate/" target="_self">MergeTemplate</a> command is almost the same as <em>RunTemplates</em>, but can be subject to an &lt;&lt;If()&gt;&gt; command, and so can be run depending on conditions that the template author dictates.  Also, <em>MergeTemplate</em> does not present a new interview for the template to be merged (as does <em>RunTemplates</em>), XpressDox uses the data set which was used for the preceding template for this.</p>
<p>A code sample of how this might work in practice would be the following snippet:</p>
<blockquote><p>&lt;&lt;ChooseUsingCheckBox(CoveringLetter,Y,N,N)&gt;&gt;<br />
&lt;&lt;ChooseUsingCheckBox(Account,Y,N,N)&gt;&gt;<br />
&lt;&lt;ChooseUsingCheckBox(Contract,Y,N,N)&gt;&gt;<br />
&#8230;<br />
&#8230;<br />
&lt;&lt;ChooseFromRDBList(ContractType,,A~~Contract Type A &#8211; Service Agreement,B~~ContractType B &#8211; Renewal of Service Agreement)&gt;&gt;<br />
&#8230;  (somewhere in this template (or a template included by &lt;&lt;IncludeTemplate()&gt;&gt;) would be commands to make sure that the interview captures all the information needed on the templates to be merged)<br />
&#8230;<br />
&lt;&lt;If(CoveringLetter = &#8216;Y&#8217;)&gt;&gt;&lt;&lt;MergeTemplate(&#8216;Covering Letter&#8217;)&gt;&gt;&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Account = &#8216;Y&#8217;)&gt;&gt;&lt;&lt;MergeTemplate(&#8216;Account&#8217;)&gt;&gt;&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Contract = &#8216;Y&#8217;)&gt;&gt;&lt;&lt;MergeTemplate(concat(&#8216;Contract&#8217;,ContractType))&gt;&gt;&lt;&lt;End()&gt;&gt;</p></blockquote>
<p>If you call this template something like &#8220;MasterTemplate&#8221;, then all the user needs to do is run that one MasterTemplate, and all the decisions as to which further templates to be run are effectively made for them by the template logic.</p>
<h3>Build all the subsidiary templates into one single document</h3>
<p>Sometimes the requirement is that all the chosen documents are merged into one long document, rather than each being a separate document (the <em>MergeTemplate </em>command will create a separate Word document for each template merged).</p>
<p>This could be done by using the <a title="The IncludeTemplate Command" href="http://www.xpressdox.com/help/reference/includetemplate/" target="_self">IncludeTemplate</a> command in the place where <em>MergeTemplate</em> is used above.  The drawback of this is that <em>IncludeTemplate</em> will include the entire text of the template BEFORE the interview is presented, and if that text is excluded via an <em>If</em> command, that is done while the template is being merged.  This is satisfactory if there are not too many long templates thus included, but if the included templates are large and/or many then the resulting pre-interview text can be enormous and give rise to memory problems.</p>
<p>In a situation like this, the solution would be to use the <a title="Inserting templates with variable names" href="http://www.xpressdox.com/help/reference/inserting-documents/" target="_self">InsertTemplate</a> command.  The <em>InsertTemplate</em> command is very similar in effect to IncludeTemplate, except that the text of the template is inserted into the merged document during the phase when the template is being merged. (The different phases of XpressDox are described in <a title="The Processing Phases of XpressDox" href="http://www.xpressdox.com/help/reference/processing-phases/" target="_self">The Processing Phases of XpressDox</a>).</p>
<p>There are some issues surrounding the insertion of one Word document into another (regardless of which command is used), these are <a title="Source and destination formatting" href="http://www.xpressdox.com/help/reference/source-destination-formatting/" target="_self">Source and destination formatting</a>, and Word section processing, specifically with regard to headers and footers and paragraph and page numbering.</p>
<p>It is highly recommended that <em>Destination </em>formatting be used.  It means that care has to be taken to make sure that styles used in the inserted template are also defined (correctly) in the master template, and that Word skills are used to make sure that any paragraph numbering starts off at 1 again on the inserted document.  That is all the subject of another article, yet to be written.</p>
<p>In order that headers and footers in the inserted document are included correctly into the master document, the command needs to be issued with the <em>PreserveHeaders </em>parameter:</p>
<blockquote><p>&lt;&lt;InsertTemplate(&#8216;letters:Covering Letter&#8217;,Destination,PreserveHeaders)&gt;&gt;</p></blockquote>
<p>The next issue to be catered for is the question of encouraging Word to put its section breaks into the correct place.  You will probably want to experiment yourself, but an example that works would look something like this:</p>
<blockquote><p>&#8230;<br />
================= Section Break (Continuous) ========================<br />
&lt;&lt;If(CoveringLetter = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;InsertTemplate(&#8216;Covering Letter&#8217;,Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Account = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;InsertTemplate(&#8216;Account&#8217;,Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Contract = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;InsertTemplate(concat(&#8216;Contract&#8217;,ContractType),Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;</p></blockquote>
<p>Actually, that example will not work correctly, as each template inserted will be preceded by a <em>Section Break (Next Page)</em> whereas only the first template needs that Section Break.  This then needs some code to make sure that it happens only once, and the following example will do it:</p>
<blockquote><p>&#8230;<br />
&lt;&lt;SetVr(&#8216;SB&#8217;,'Y&#8217;)&gt;&gt;<br />
================= Section Break (Continuous) ========================<br />
&lt;&lt;If(CoveringLetter = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;InsertTemplate(&#8216;Covering Letter&#8217;,Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;SetVr(&#8216;SB&#8217;,'N&#8217;)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Account = &#8216;Y&#8217;)&gt;&gt;<br />
&lt;&lt;If(GetV(&#8216;SB&#8217;) = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;InsertTemplate(&#8216;Account&#8217;,Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;SetVr(&#8216;SB&#8217;,'N&#8217;)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;If(Contract = &#8216;Y&#8217;)&gt;&gt;<br />
&lt;&lt;If(GetV(&#8216;SB&#8217;) = &#8216;Y&#8217;)&gt;&gt;<br />
================== Section Break (Next Page) ========================<br />
&lt;&lt;End()&gt;&gt;<br />
&lt;&lt;InsertTemplate(concat(&#8216;Contract&#8217;,ContractType),Destination,PreserveHeaders)&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;</p></blockquote>
<p>How this works is that the XpressDox <a title="Using variables" href="http://www.xpressdox.com/help/cookbook/using-variables/" target="_self">variable</a> <em>SB</em> determines whether a Section Break (Next Page) should be inserted or not.  It starts off its life with the value &#8216;Y&#8217; so that the first template which is inserted will be preceded by a section break.  But then after each template is inserted, the variable is set to &#8216;N&#8217; so that for each subsequently inserted template, the section break will not be inserted.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/reference/inserting-documents/' rel='bookmark' title='Inserting templates with variable names'>Inserting templates with variable names</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/page-breaks/' rel='bookmark' title='Working with Page Breaks'>Working with Page Breaks</a></li>
<li><a href='http://www.xpressdox.com/help/reference/includetemplated/' rel='bookmark' title='The IncludeTemplate Command'>The IncludeTemplate Command</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/section-breaks/' rel='bookmark' title='Working with Section Breaks'>Working with Section Breaks</a></li>
<li><a href='http://www.xpressdox.com/help/reference/mergetemplate/' rel='bookmark' title='The MergeTemplate function'>The MergeTemplate function</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/master-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search for a file using the Explorer</title>
		<link>http://www.xpressdox.com/help/cookbook/search-explorer/</link>
		<comments>http://www.xpressdox.com/help/cookbook/search-explorer/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 09:11:17 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Explorer]]></category>
		<category><![CDATA[Explorer-search]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=3484</guid>
		<description><![CDATA[The XpressDox Explorer does not contain an explicit &#8220;Search&#8221; function.  Nonetheless, you can search in the currently open folder for a file, using the Windows file system&#8217;s wild card syntax. The example below demonstrates how the wild card string *letter*.xdtpl will list all (and only) XpressDox templates with the string &#8220;letter&#8221; in the file name [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/search-explorer/" title="Permanent link to Search for a file using the Explorer"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/intermediate.jpg" width="177" height="16" alt="Post image for Search for a file using the Explorer" /></a>
</p><p>The <a title="Moving around in XpressDox: The Explorer" href="http://www.xpressdox.com/help/cookbook/navigating-xpressdox /" target="_self">XpressDox Explorer</a> does not contain an explicit &#8220;Search&#8221; function.  Nonetheless, you can search in the currently open folder for a file, using the Windows file system&#8217;s <em>wild card</em> syntax.</p>
<p>The example below demonstrates how the wild card string <em>*letter*.xdtpl</em> will list all (and only) XpressDox templates with the string &#8220;letter&#8221; in the file name (type the wild card string in the <em>File name</em> area and then press the <em>Open</em> button)<br />
<img class="alignleft" title="XpressDox Explorer" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/explorer-search.jpg" alt="XpressDox Explorer" width="648" height="506" /></p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/navigating-xpressdox/' rel='bookmark' title='Moving around in XpressDox: The Explorer'>Moving around in XpressDox: The Explorer</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-2-2-7/' rel='bookmark' title='Version 2.2.7 (2009-10-16)'>Version 2.2.7 (2009-10-16)</a></li>
<li><a href='http://www.xpressdox.com/help/reference/getvalidfilename-function/' rel='bookmark' title='GetValidFileName function &#8211; removes or replaces illegal characters from a file name'>GetValidFileName function &#8211; removes or replaces illegal characters from a file name</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/sql-server-data-source/' rel='bookmark' title='Use a SQL Server Data Source to include Customer information on a template'>Use a SQL Server Data Source to include Customer information on a template</a></li>
<li><a href='http://www.xpressdox.com/help/reference/advanced-file-handling/' rel='bookmark' title='Advanced file handling'>Advanced file handling</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/search-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Rose by any other name</title>
		<link>http://www.xpressdox.com/help/cookbook/a-rose-by-any-other-name/</link>
		<comments>http://www.xpressdox.com/help/cookbook/a-rose-by-any-other-name/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 16:35:26 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Data Element]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=3427</guid>
		<description><![CDATA[or, what should I call this data element? One of the advantages of template development in XpressDox is that it is not necessary to spend a lot of time deciding on names for data elements.  You can create a good first-time template just by plunking in fillpoints like &#60;&#60;surname&#62;&#62; &#60;&#60;Address&#62;&#62; &#60;&#60;First_Names&#62;&#62; &#60;&#60;salutation&#62;&#62; and away you [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/a-rose-by-any-other-name/" title="Permanent link to A Rose by any other name"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/intermediate.jpg" width="177" height="16" alt="Post image for A Rose by any other name" /></a>
</p><p>or, what should I call this data element?</p>
<p>One of the advantages of template development in XpressDox is that it is not necessary to spend a lot of time deciding on names for data elements.  You can create a good first-time template just by plunking in fillpoints like &lt;&lt;surname&gt;&gt; &lt;&lt;Address&gt;&gt; &lt;&lt;First_Names&gt;&gt; &lt;&lt;salutation&gt;&gt; and away you go &#8211; an automatic interview will be created and you can capture the data and merge it into the template to create whatever document it is.</p>
<p>That&#8217;s good as far as it  goes &#8211; you can get started with XpressDox very quickly.  You don&#8217;t have to design, even conceptually, all the templates and their interactions and create a &#8220;data dictionary&#8221; before you get going.  Just make templates and keep going until they&#8217;re all finished.</p>
<p>The problem is that without some help, the fields that you typed as &lt;&lt;surname&gt;&gt;, &lt;&lt;First_Names&gt;&gt; on the first template end up as &lt;&lt;Surname&gt;&gt; and &lt;&lt;Firstnames&gt;&gt; on one or other later template.  And, because the field names are really XML data element names, <em>surname </em>and <em>Surname </em>are not the same thing, and definitely not <em>First_Names</em> and <em>Firstnames</em>.</p>
<p>Now, XpressDox does provide quite a lot of help in getting a consistent set of data element names, mainly via the <a title="The Command Editor" href="http://www.xpressdox.com/help/cookbook/command-editor /" target="_self">Command Editor</a>, which enables the display of already-chosen data elements in a way that the template author can re-use them correctly.  However, experienced template authors tend to want to use just the keyboard and type all of the XpressDox fillpoints without having continual recourse to the Command Editor.  For no other reason than this, it is useful to start off on a large project (i.e. many templates and/or many data elements) by deciding on a naming convention for the data elements.  This does not mean that you need to decide on all the data elements up front, but that you decide on how you will assign a name to each new data element that you need to create as you go.</p>
<p>What follows is a set of suggestions (backed up by many lessons over the years from the school of hard knocks) not a set of rules. Probably you could add your own or make your own adaptations.  Even so, when you design a set of naming conventions for your organisation, then they MUST become rules, and all template authors in your organisation MUST abide by them &#8211; otherwise chaos will be the rule.   Here follow a set of rules (in addition to the obvious one, i.e. that data element names should conform to <a title="XML and Data Sets" href="http://www.xpressdox.com/help/reference/xml-data-set /" target="_self">rules for XML element names</a>), although the first one is a kind of meta-rule:</p>
<ol>
<li>You should have a data element naming convention, even a bad one is better than none.</li>
<li>Call your data elements what they are.   For example, if a data element&#8217;s value is an interest rate, call it <em>InterestRate</em>, not <em>Interest </em>and not <em>Rate</em>.  Even better, call it <em>InterestRatePercentage</em>.</li>
<li>Try not to abbreviate.  This and the previous item go together:  usually you will abbreviate to save typing, but abbreviations often end up being cryptic and after all, the Command Editor is there to help get the name right.  Think about how someone else will read your template and either understand it or not.  And remember, that &#8220;someone else&#8221; is likely to be yourself in a few weeks/months/years and then you won&#8217;t remember that you abbreviated <em>InterestRate </em>to <em>Int </em>and <em>InterestAmount </em>to <em>Intrst</em>.</li>
<li>Because of Rule 2 you will end up having many data element names which consist of more than one natural language word (like &#8220;interest rate&#8221; becoming <em>InterestRate </em>or <em>Interest_Rate</em>).  You need to decide how you will designate and delineate those words.  My own preference is to use so-called <a title="Pascal Case" href="http://en.wikipedia.org/wiki/Pascal_case">Pascal case</a>, whereas others will separate the words with an underscore, and have different rules regarding whether to use upper or lower case at the start of each word in the name.  Almost universal, though, is an abhorrence for using ALL CAPITALS which tend to make the marked up text look very noisy.</li>
</ol>
<p>That&#8217;s it &#8211; one meta rule and three rules.  Easy enough to remember when there are only 3, but worth the effort in the long run.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/tips-and-hints-rule/' rel='bookmark' title='Tips and Hints using the Rule Command'>Tips and Hints using the Rule Command</a></li>
<li><a href='http://www.xpressdox.com/help/reference/xml-data-set/' rel='bookmark' title='XML and Data Sets'>XML and Data Sets</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/a-rose-by-any-other-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypt a template</title>
		<link>http://www.xpressdox.com/help/cookbook/encrypt-template/</link>
		<comments>http://www.xpressdox.com/help/cookbook/encrypt-template/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 11:42:07 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[explorer password]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=3391</guid>
		<description><![CDATA[You want people to be able to run a template that you have made, but don&#8217;t want anyone other than yourself to read or modify the template.  This can be achieved by encrypting the template. A template can be encrypted when saving it in the XpressDox Explorer.  When saving a template, the XpressDox Explorer will [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/encrypt-template/" title="Permanent link to Encrypt a template"><img class="post_image alignnone" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/advanced.jpg" width="177" height="16" alt="Post image for Encrypt a template" /></a>
</p><p>You want people to be able to run a template that you have made, but don&#8217;t want anyone other than yourself to read or modify the template.  This can be achieved by encrypting the template.</p>
<p>A template can be encrypted when saving it in the <a title="Moving around in XpressDox" href="http://www.xpressdox.com/help/reference/navigating-xpressdox /" target="_self">XpressDox Explorer</a>.  When saving a template, the XpressDox Explorer will open so that a name can be provided for the template file.  On the bottom right corner of the Explorer form, to the right of the <em>Save </em>button, there is an area where a password can be entered.  As soon as XpressDox finds a password in that area, it does the following:</p>
<ol>
<li>Encrypts the password and saves it into the template.</li>
<li>Encrypts the template text  then saves it in the file name provided.</li>
<li>Stores a copy of the un-encrypted template into the folder named &#8220;PreCrypto&#8221; which XpressDox creates as a sub-folder of the template folder.  This ensures that in the case where the template author forgets the password, s/he can always recover an unencrypted copy of the template to work with.  Care must be taken not to deliver that PreCrypto folder contents along with the encrypted template, or in other ways made available to unauthorised users.</li>
</ol>
<p><img class="alignleft" title="XpressDox Explorer" src="http://www.xpressdox.com/wordpress/wp-content/assets/images/explorer-encrypt.jpg" alt="XpressDox Explorer" width="681" height="476" /><br />
Once a template is encrypted, it can only be opened for editing (or even if only for reading) by the XpressDox Explorer, and a user attempting to open the template will be prompted for the password.  Only if the user supplies the correct password will the template open in Word.</p>
<p>However, an encrypted template (or a template including an encrypted template via &lt;&lt;IncludeTemplate()&gt;&gt;) can be run by anyone without the need to provide the password.</p>
<p>The encryption facility and the <a title="The RestrictToLicenses Command" href="http://www.xpressdox.com/help/reference/restricttolicenses/" target="_self">RestrictToLicenses command</a> can be used together to protect a reseller&#8217;s templates from being pirated.</p>
<p>The encryption and RestrictToLicenses can be applied to a sub-template which is included in every template in a suite of templates (along the same lines as <a title="Data capture interview layout tips" href="http://www.xpressdox.com/help/cookbook/dialog-layout-tips/" target="_self">layout commands</a>). In this way sensitive document assembly commands can be protected whereas the more mundane processes can be left unencrypted.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/new/version-3-3-1/' rel='bookmark' title='Version 3.3.1'>Version 3.3.1</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/search-explorer/' rel='bookmark' title='Search for a file using the Explorer'>Search for a file using the Explorer</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/navigating-xpressdox/' rel='bookmark' title='Moving around in XpressDox: The Explorer'>Moving around in XpressDox: The Explorer</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/one-template-many-datasets/' rel='bookmark' title='Run a template for a number of data sets, and print the merged documents'>Run a template for a number of data sets, and print the merged documents</a></li>
<li><a href='http://www.xpressdox.com/help/reference/optimizeparsing/' rel='bookmark' title='The OptimizeParsing Command'>The OptimizeParsing Command</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/encrypt-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

