<?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 &#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>Document Assembly Made Simple</description>
	<lastBuildDate>Fri, 03 Sep 2010 12:21:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Document per Repeated Item – with Filter</title>
		<link>http://www.xpressdox.com/help/cookbook/doc-per-repeated-item-filter/</link>
		<comments>http://www.xpressdox.com/help/cookbook/doc-per-repeated-item-filter/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 11:03:10 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Repeating Data]]></category>
		<category><![CDATA[SetMultipleDocumentFilter]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2908</guid>
		<description><![CDATA[The Document per Repeated Item feature can also be filtered so that only those repeated items fulfilling a particular set of criteria will have a document prepared.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/doc-per-repeated-item-filter/" title="Permanent link to Document per Repeated Item – with Filter"><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 Document per Repeated Item – with Filter" /></a>
</p><p>Please see the recipe <a title="Document per Repeated Item" href="http://www.xpressdox.com/help/cookbook/document-per-repeated-item /" target="_self">Document per Repeated Item</a> for an introduction to this concept.</p>
<p>Now, following on from the above discussion, suppose we need a separate document for each of the sureties, but only if a particular surety has a net asset value of $100,000 or more.  The template itself will remain unchanged except that a <em><a title="The SetMultipleDocumentFilter Command" href="http://www.xpressdox.com/help/reference/setmultipledocumentfilter /" target="_self">SetMultipleDocumentFilter</a></em> command will be applied to it.  Here follows the original example, slightly modified and incorporating with this new command:</p>
<blockquote><p>I, <code>&lt;&lt;Surety[$SuretyNumber]/SuretyFirstNames&gt;&gt;</code> <code>&lt;&lt;Surety[$SuretyNumber]/SuretySurname&gt;&gt;</code> (Born on <code>&lt;&lt;FormatDate(Surety[$SuretyNumber]/SuretyDOB, “dd MMMM yyyy”)&gt;&gt;</code>) hereby declare blah blah.<br />
blah</p>
<p>My net assets are $<code>&lt;&lt;FormatNumber(Surety[$SuretyNumber]/NetAssets)&gt;&gt;</code></p>
<p><code>&lt;&lt;SetMultipleDocumentFilter(NetAssets &gt;= 100000)&gt;&gt;</code></p>
<p>Signed: <code>&lt;&lt;Surety[$SuretyNumber]/SuretyFirstNames&gt;&gt;</code> <code>&lt;&lt;Surety[$SuretyNumber]/SuretySurname&gt;&gt;</code></p></blockquote>
<p>This would result in one document being produced for each surety, but only if that particular surety&#8217;s net asset value is greater than $100,000.</p>
<p>This is fine so long as the minimum net asset value is always going to be $100,000.  But suppose you want the user (i.e. the person running the template) to be able to set this minimum value from one application to another.  You would then have a data element called something like <em>MinimumAssetValue</em> which is captured in the interview outside the scope of the sureties, and the resulting template snippet would look like this:</p>
<blockquote><p><code>&lt;&lt;CaptureDataElement(MinimumAssetValue,Decimal)&gt;&gt;</code></p>
<p>I, <code>&lt;&lt;Surety[$SuretyNumber]/SuretyFirstNames&gt;&gt;</code> <code>&lt;&lt;Surety[$SuretyNumber]/SuretySurname&gt;&gt;</code> (Born on <code>&lt;&lt;FormatDate(Surety[$SuretyNumber]/SuretyDOB, “dd MMMM yyyy”)&gt;&gt;</code>) hereby declare blah blah.<br />
blah</p>
<p>My net assets are $<code>&lt;&lt;FormatNumber(Surety[$SuretyNumber]/NetAssets)&gt;&gt;</code></p>
<p><code>&lt;&lt;SetMultipleDocumentFilter(NetAssets &gt;= ../MinimumAssetValue)&gt;&gt;</code></p>
<p>Signed: <code>&lt;&lt;Surety[$SuretyNumber]/SuretyFirstNames&gt;&gt;</code> <code>&lt;&lt;Surety[$SuretyNumber]/SuretySurname&gt;&gt;</code></p></blockquote>
<p>You will notice the ../ before MinimumAssetValue.  This is because the scope of the data elements in the condition is by default the repeating data element &#8211; in this case <em>Surety</em>.  In order to reference a data element higher in the XML hierarchy, the ../ notation is used.  A fairly comprehensive discussion of this is contained in the recipe <a title="Working with repeated elements" href="http://www.xpressdox.com/help/cookbook/working-with-repeated-elements /" target="_self">Working with repeated elements</a> under the heading <em>Referencing Non-repeating elements within a ForEach block</em>.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/document-per-repeated-item/' rel='bookmark' title='Permanent Link: Document per Repeated Item'>Document per Repeated Item</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/test-for-any-or-all/' rel='bookmark' title='Permanent Link: Test for Any or All repeated items meeting criteria'>Test for Any or All repeated items meeting criteria</a></li>
<li><a href='http://www.xpressdox.com/help/reference/setmultipledocumentfilter/' rel='bookmark' title='Permanent Link: The SetMultipleDocumentFilter command'>The SetMultipleDocumentFilter command</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/working-with-repeated-elements/' rel='bookmark' title='Permanent Link: Working with repeated elements'>Working with repeated elements</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/doc-per-repeated-item-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Repeating Data – Part 2</title>
		<link>http://www.xpressdox.com/help/cookbook/repeating-data-part-2/</link>
		<comments>http://www.xpressdox.com/help/cookbook/repeating-data-part-2/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 16:15:31 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[ForEach]]></category>
		<category><![CDATA[Repeating Data]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2782</guid>
		<description><![CDATA[A common issue with repeating data is the requirement to refer to the items within the list by their ordinal values.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/repeating-data-part-2/" title="Permanent link to Working with Repeating Data – Part 2"><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 Repeating Data – Part 2" /></a>
</p><p>This recipe continues the discussion in <a title="Working with repeated elements" href="http://www.xpressdox.com/help/reference/working-with-repeated-elements /" target="_self">Working with repeated elements</a>, which has as its example a Will where the children are the repeating elements.</p>
<p>Another common issue with repeating data is the requirement firstly to present a list of the repeating instances (in the previous example, the children) and then refer to items within the list by their ordinal values (i.e. first, second, third, etc.).  This is a rather complicated way of saying something like this:</p>
<p>Suppose some of the children in the list are still at school, and some not.  Then suppose the Will needs to refer to the still-at-school children by saying something like:</p>
<blockquote><p>Any children still in school, which at the time of writing are the second, third and fifth child, will be provided for &#8230;.</p></blockquote>
<p>As a starting point, something like this would get the process going:</p>
<blockquote><p>Any children still in school, which at the time of writing  <code>&lt;&lt;When(count(Child[StillInSchool = “Yes”]) &gt; 1,are,is)&gt;&gt; the &lt;&lt;ForEach(Child)&gt;&gt;&lt;&lt;If(StillInSchool = ‘Yes’)&gt;&gt;&lt;&lt;Ordinal()&gt;&gt;&lt;&lt;When(count(../Child) &gt; 1),!, )&gt;&gt; &lt;&lt;End()&gt;&gt;&lt;&lt;End(forEach)&gt;&gt;</code> child, will be provided for &#8230;</p></blockquote>
<p>This will work nicely if there is more than one child, but will not place “and” between the last and second-last children.  Usually this is tackled using the <em>last()</em> function, but <em>last()</em> applies to all of the elements in the ForEach, and in this case that is not correct, as we need it to apply only to the sub-list of children who are still at school, not to all the children.</p>
<p>What we need to do is keep a separate count of children still at school (i.e. set a variable to the value of <em>count(Child[StillAtSchool = ‘Yes’)])</em>) and also a manual version of <em>position()</em> – recording the position in the sub-list of still-at-school children.  For this we will set a variable <em>NumberOfSchoolChild</em> which will be incremented each time a still-in-school child is dealt with.</p>
<p>This is what it would look like:</p>
<blockquote><p><code>&lt;&lt;SetV(‘TotalSchoolChildren”,count(Child[StillAtSchool = “Yes”]))&gt;&gt;</code><br />
<code>&lt;&lt;SetV(‘NumberOfSchoolChild’,1)&gt;&gt;&lt;&lt;SetV(‘OneLess’,GetV(‘TotalSchoolChildren’)-1)&gt;&gt;</code></p>
<p>Any children still in school, which are the time of writing <code>&lt;&lt;When(GetV(‘TotalSchoolChildren’) &gt; 1,are,is)&gt;&gt; the &lt;&lt;ForEach(Child)&gt;&gt;&lt;&lt;If(StillAtSchool = “Yes”)&gt;&gt;&lt;&lt;Ordinal()&gt;&gt;&lt;&lt;If(GetV(‘TotalSchoolChildren’) &gt; 1)&gt;&gt;&lt;&lt;If(GetV(‘NumberOfSchoolChild’) &lt; GetV(‘OneLess’))&gt;&gt;, &lt;&lt;Else()&gt;&gt;&lt;&lt;If(GetV(‘NumberOfSchoolChild’) = GetV(‘OneLess’))&gt;&gt; and &lt;&lt;End()&gt;&gt;&lt;&lt;End(If/Else)&gt;&gt;&lt;&lt;End(TotalSchoolChildren &gt; 1)&gt;&gt;&lt;&lt;SetV(‘NumberOfSchoolChild’,GetV(‘NumberOfSchoolChild’)+1)&gt;&gt;&lt;&lt;End(StillAtSchool)&gt;&gt;&lt;&lt;End(ForEach)&gt;&gt;</code> child, will be provided for &#8230;</p></blockquote>
<p>It is quite complicated, but then it’s a complicated problem!  And this is the solution.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/concatenating-strings/' rel='bookmark' title='Permanent Link: Concatenating strings'>Concatenating strings</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/test-for-any-or-all/' rel='bookmark' title='Permanent Link: Test for Any or All repeated items meeting criteria'>Test for Any or All repeated items meeting criteria</a></li>
<li><a href='http://www.xpressdox.com/help/reference/foreach-list-ordinal/' rel='bookmark' title='Permanent Link: ForEach, List, Ordinal: Handling repeating data'>ForEach, List, Ordinal: Handling repeating data</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/working-with-repeated-elements/' rel='bookmark' title='Permanent Link: Working with repeated elements'>Working with repeated elements</a></li>
<li><a href='http://www.xpressdox.com/help/reference/syntax-notes/' rel='bookmark' title='Permanent Link: Notes on XpressDox syntax'>Notes on XpressDox syntax</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/repeating-data-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The CaptureLater Command</title>
		<link>http://www.xpressdox.com/help/cookbook/capturelater/</link>
		<comments>http://www.xpressdox.com/help/cookbook/capturelater/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 13:37:56 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[CaptureLater]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2671</guid>
		<description><![CDATA[When a template is run, XpressDox constructs a data capture interview which is guided by the XpressDox merge fields which are coded in the template.  The CaptureLater command is one of the commands which can be used to influence this.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/capturelater/" title="Permanent link to The CaptureLater Command"><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 The CaptureLater Command" /></a>
</p><p>The <em>CaptureLater </em>command assists the template author in defining the relative position of data elements on the data capture interview screen.</p>
<p>When a template is run, XpressDox constructs a data capture interview which is guided by the XpressDox merge fields which are coded in the template.  In particular, the sequence in which controls (those areas on the form where data values are typed) appear on the screen is the sequence in which the corresponding data elements are encountered by XpressDox in the template.</p>
<p>Thus a template looking something like:</p>
<blockquote><p>&lt;&lt;Addressee&gt;&gt;<br />
&lt;&lt;AddressLine1&gt;&gt;<br />
&lt;&lt;AddressLine2&gt;&gt;</p></blockquote>
<p>would result in the controls for <em>Addressee</em>, <em>AddressLine1</em> and <em>AddressLine2</em> appearing in the interview in that sequence.</p>
<p>However, a slight modification to this, such as:</p>
<blockquote><p>&lt;&lt;Heading(AddressLine1,ADDRESS INFORMATION)&gt;&gt;<br />
&lt;&lt;Addressee&gt;&gt;<br />
&lt;&lt;AddressLine1&gt;&gt;<br />
&lt;&lt;AddressLine2&gt;&gt;</p></blockquote>
<p>would cause <em>AddressLine1</em> to appear first in the interview (followed by <em>Addressee</em> and then <em>AddressLine2</em>), as the <em>Heading</em> command is the first place that <em>AddressLine1</em> is referred to.</p>
<p>Some template authors take advantage of this behaviour by, for example, defining a template with only &lt;&lt;Caption&gt;&gt;, &lt;&lt;Heading&gt;&gt; and &lt;&lt;CaptureDataElement&gt;&gt; commands which is included at the start of all templates (with the &lt;&lt;IncludeTemplate&gt;&gt; command) and this has the effect of defining the sequence in which data elements appear on all interviews for those templates.  Read more about layout of the interview <a title="Tips for Laying Out the Interview" href="http://www.xpressdox.com/help/cookbook/dialog-layout-tips /" target="_self">here</a>.</p>
<p>However, there is a side effect of this behaviour related to the &lt;&lt;BaseTemplate&gt;&gt; command, which may not be desired.</p>
<p>For example, a template (called the <em>originating</em> template) contains the &lt;&lt;BaseTemplate(CompanyLetterHead)&gt;&gt; command.  The base template (i.e. the template called CompanyLetterHead.xdtpl) looks something like:</p>
<blockquote><p>&lt;&lt;Addressee&gt;&gt;<br />
&lt;&lt;AddressLine1&gt;&gt;<br />
&lt;&lt;AddressLine2&gt;&gt;</p>
<p>&lt;&lt;DocumentBody&gt;&gt;</p></blockquote>
<p>and the originating template (whose text will replace the &lt;&lt;DocumentBody&gt;&gt; field in the base template) looks something like:</p>
<blockquote><p>&lt;&lt;BaseTemplate(CompanyLetterHead)&gt;&gt;<br />
&lt;&lt;Caption(ProductName,Name of Product)&gt;&gt;<br />
&lt;&lt;Caption(SerialNo,Serial Number)&gt;&gt;<br />
&#8230;<br />
&#8230;<br />
&#8230;</p></blockquote>
<p>The intention of the template author is that the data elements <em>ProductName</em> and <em>SerialNo</em> appear at the top of the interview.</p>
<p>However, when the interview is constructed, the “template” that XpressDox is given to analyse is actually the <em>base template with the originating template inserted where &lt;&lt;DocumentBody&gt;&gt; used to be</em>.  That means that XpressDox “sees” the <em>Addressee</em>, <em>AddressLine1</em> and <em>AddressLine2</em> data elements before it sees the <em>Caption</em> commands for <em>ProductName </em>and <em>SerialNo</em>.  What this means is that the data elements in the base template will automatically appear in the interview above all the elements defined in the originating template.  Which in this example is not what the template author wants.</p>
<p>The <em>CaptureLater</em> command was introduced to assist with this sort of scenario.  When the command &lt;&lt;CaptureLater(Addressee)&gt;&gt; appears somewhere after the &lt;&lt;Addressee&gt;&gt; field (or, in fact, after any other command referencing the <em>Addressee</em> data element), this instructs XpressDox to defer its decision about where to place the <em>Addressee</em> field on the interview until it encounters another merge field referring to <em>Addressee</em>.  If this next occurrence (after the <em>CaptureLater</em> command) of <em>Addressee</em> itself is followed by &lt;&lt;CaptureLater(Addressee)&gt;&gt; then the process continues until either an occurrence of <em>Addressee</em> is NOT followed by <em>CaptureLater</em>, or until the last occurrence of <em>Addressee</em> (whether followed by <em>CaptureLater</em> or not), in which case this defines the relative position of <em>Addressee</em> on the interview.</p>
<p>In the example above, the Base template could be coded something like:</p>
<blockquote><p>&lt;&lt;Addressee&gt;&gt;<br />
&lt;&lt;AddressLine1&gt;&gt;<br />
&lt;&lt;AddressLine2&gt;&gt;</p>
<p>&lt;&lt;CaptureLater(Addressee)&gt;&gt;&lt;&lt;CaptureLater(AddressLine1)&gt;&gt;&lt;&lt;CaptureLater(AddressLine2)&gt;&gt;</p>
<p>&lt;&lt;DocumentBody&gt;&gt;</p></blockquote>
<p>This would have the effect that the relative positioning of the three data elements (i.e. the 3 referred to in the <em>CaptureLater </em>commands) on the interview would be defined by the positions of those data elements within the originating template.  If the originating template has no reference to the three address data elements, then the <em>CaptureLater</em> commands have no effect and the address data elements are positioned relative to where they were last encountered – i.e. at the top of the interview.</p>
<p>Another mechanism for directing the position of those three data elements in the interview would be to place the following in the <em>originating</em> template at the relevant position:</p>
<blockquote><p>&#8230;<br />
&#8230;</p>
<p>&lt;&lt;CaptureLater(Addressee)&gt;&gt;&lt;&lt;CaptureLater(AddressLine1)&gt;&gt;&lt;&lt;CaptureLater(AddressLine2)&gt;&gt;<br />
&lt;&lt;CaptureDataElement(Addressee)&gt;&gt;&lt;&lt;CaptureDataElement(AddressLine1)&gt;&gt;&lt;&lt;CaptureDataElement(AddressLine2)&gt;&gt;</p></blockquote>
<p class="alert">The <em>CaptureLater</em> command was introduced with Version 3 of XpressDox and is unavailable in previous versions.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/dialog-layout-tips/' rel='bookmark' title='Permanent Link: Data capture interview layout tips'>Data capture interview layout tips</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/laying-out-data-capture/' rel='bookmark' title='Permanent Link: Laying out the data capture interview'>Laying out the data capture interview</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/define-layout/' rel='bookmark' title='Permanent Link: Define layout in a base template'>Define layout in a base template</a></li>
<li><a href='http://www.xpressdox.com/help/reference/caption-command/' rel='bookmark' title='Permanent Link: Caption command: provide a useful name for data capture'>Caption command: provide a useful name for data capture</a></li>
<li><a href='http://www.xpressdox.com/help/reference/customizing-base-templates/' rel='bookmark' title='Permanent Link: Customizing and using base templates'>Customizing and using base templates</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/capturelater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding comments to a template</title>
		<link>http://www.xpressdox.com/help/cookbook/adding-comments/</link>
		<comments>http://www.xpressdox.com/help/cookbook/adding-comments/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 11:12:59 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Comment]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2616</guid>
		<description><![CDATA[Comments can be added to a template either within the body of  a command, or using the Comment command.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/adding-comments/" title="Permanent link to Adding comments to a template"><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 Adding comments to a template" /></a>
</p><p>When the template logic becomes complicated or there is some other need to record why certain constructs were used in a template, then commenting becomes useful and necessary.</p>
<p>Comments can be added to a template in two ways:</p>
<p>1. Include the comment text in the command itself.   (This applies to <em>commands</em> as against <em>functions</em>, although this will be rectified with time.  More information on commands and functions is available at <a title="Commands and Functions" href="http://www.xpressdox.com/help/reference/commands-and-functions /" target="_self">Commands and Functions</a>).</p>
<p>This is done by typing the comment after the closing parenthesis of the command, e.g.:</p>
<p><code>&lt;&lt;ForEach(Child[Age < 12]) produce a list of the children aged below 12&gt;&gt;</code></p>
<p>2. The second mechanism for entering a comment in to the template is to use the <em>Comment</em> command, e.g.:</p>
<p><code>&lt;&lt;Comment(The next few lines will produce a list of the children and their ages.  This is necessary for clarification purposes.)&gt;&gt;</code></p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/repeating-data-part-2/' rel='bookmark' title='Permanent Link: Working with Repeating Data – Part 2'>Working with Repeating Data – Part 2</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/test-for-any-or-all/' rel='bookmark' title='Permanent Link: Test for Any or All repeated items meeting criteria'>Test for Any or All repeated items meeting criteria</a></li>
<li><a href='http://www.xpressdox.com/help/reference/syntax-notes/' rel='bookmark' title='Permanent Link: Notes on XpressDox syntax'>Notes on XpressDox syntax</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/working-with-repeated-elements/' rel='bookmark' title='Permanent Link: Working with repeated elements'>Working with repeated elements</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/concatenating-strings/' rel='bookmark' title='Permanent Link: Concatenating strings'>Concatenating strings</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/adding-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Command Editor</title>
		<link>http://www.xpressdox.com/help/cookbook/command-editor/</link>
		<comments>http://www.xpressdox.com/help/cookbook/command-editor/#comments</comments>
		<pubDate>Tue, 11 May 2010 15:25:27 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Command Editor]]></category>
		<category><![CDATA[Template Authors Toolkit]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2541</guid>
		<description><![CDATA[The Command Editor empowers the template author by presenting an alphabetic list of all the XpressDox commands, with functionality which provides wizards for completion of the command as well as supplying examples of commands.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/command-editor/" title="Permanent link to The Command Editor"><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 The Command Editor" /></a>
</p><p>The Command Editor empowers the template author by presenting an alphabetic list of all the XpressDox commands, with functionality which provides wizards for completion of the command as well as supplying examples of commands.  The Command Editor also provides functionality for easily selecting the correct data element from a list of existing data elements.</p>
<p>The Command Editor is best accessed via a shortcut key, which in turn means it would be preferable to add the ribbon button to Word&#8217;s Quick Access Toolbar so that it is easily accessed via the Alt key and one further keystroke.  (Or, in XpressDox for Word 2003, the shortcut key which can be seen in the XpressDox menu in Word can be used).  In the rest of this discussion the symbol &lt;key&gt; will stand for &#8220;(Press(ing)) the Command Editor shortcut key&#8221;.</p>
<h3>Getting started.</h3>
<p>Typically, the author will have a new or existing template and come to a point where she would like to enter a command but can&#8217;t remember either the command&#8217;s name or syntax or both.  Imagine that she has typed the first few characters of the command, e.g. &#8220;&lt;&lt;Choose&#8221;, but can&#8217;t remember how to continue, so presses &lt;key&gt;.  The Command Editor will display and locate the first occurrence of a command which matches the word immediately to the left of the cursor &#8211; i.e. &#8220;Choose&#8221;.  The author can then navigate either with the mouse or with the up-and-down arrow keys to the command that she requires.  Navigation can also be achieved by typing even more of the command, e.g. &#8220;ChooseUsing&#8221;, and the Editor will position itself at the command first matching that (or, typing &#8220;C&#8221; and waiting a fraction then typing &#8220;C&#8221; again will scroll through the commands beginning with the letter &#8220;C&#8221;, and so forth).</p>
<p>Once the desired command is found, &lt;double-click&gt;ing or pressing &lt;Enter&gt; will select that command &#8211; meaning that a default wizard for that command will be presented with some sample values in its fields.  The wizard fields can be modified, or else just left as is and pressing &lt;Enter&gt; (or clicking &lt;OK&gt;) will cause the resulting constructed command to be placed into the template,  replacing the &#8220;&lt;&lt;Choos&#8221; that the author had typed.</p>
<h3>Data Elements.</h3>
<p>A template author does not need assistance only with typing of commands, but also with selecting the correct data elements.  The Command Editor helps with this as follows: the lower of the two toolbars which are visible in the Command Editor has two &#8220;Filter&#8221; buttons (the two on the right each with a little funnel in it), one for commands and the other for data elements.  Checking the data elements filter (the buttons will display as highlighted when they are &#8220;checked&#8221;)  will include data elements from any templates or data sources added to the Editor by the user.  When a template is opened using the XpressDox Explorer, then its data elements are automatically included in the Command Editor view.  (Other data elements can be included by using the &lt;right-click&gt; menu items <em>Include New Data Source/Template</em> or <em>Add/Refresh Current Template</em>).</p>
<p>But when first starting off on marking up a template, there will be no data elements in the Command Editor.  One way to add new data elements to a template is to just type &lt;&lt;Name&gt;&gt; into the template document.  But, with a few more keystrokes all sorts of things are achieved.  So: the recommended way of inserting a new data element into the template is:</p>
<p>Type the name of the data element where you would like it in the template (it&#8217;s not necessary to type the &lt;&lt; beforehand).  Then press &lt;key&gt; and, (as long as the data element name is not part of an existing command or data element name) the first entry in the Command Editor is highlighted.  This is the &#8220;Insert Field&#8221; entry &#8211; pressing &lt;Enter&gt; will insert that data element into the template, surrounded with the merge field delimiters &lt;&lt; and &gt;&gt;.  In addition, the data element name appears in the Command Editor list, below all the command names.</p>
<p>This automatic insertion of the data element names into the Command Editor list also happens when a Command Editor wizard is run and the the new data element name typed into the wizard in the relevant place.</p>
<p>Thereafter, double-clicking a data element name in the Command Editor list will insert that data element into the template.</p>
<p>When a data element is required in a command (such as, for example, the first parameter to all the <em>Choose&#8230;</em> commands and many others like <em>Caption, FormatNumber, ForEach, Heading</em>,  etc.) then the wizards will present the available data elements in a drop-down list.</p>
<h3>Finding text within a command.</h3>
<p>Sometimes you don&#8217;t know how a command begins but you do know that the name contains a particular string somewhere.  &#8220;ChooseUsingCheckBox&#8221; is a case in point.  <em>&#8220;Is it ChooseWithCheckBox?  or SelectUsingCheckBox? or CaptureWithCheckBox?&#8221;</em>.  The key &lt;Ctrl &#8211; F&gt; will display the Find Area at the top of the Editor, and typing &#8220;checkbox&#8221; and pressing &lt;Enter&gt; will locate the command (and, in fact, any data element that might contain &#8220;checkbox&#8221; in its name).  If there is more than one command (or data element) which meets the search criteria, then pressing &lt;Enter&gt; will locate the next such command in the Editor.   The search for the string is not confined to the name of the command only, but also to the description, and also to the descriptions of any extra wizards and examples (available in the &lt;Right Click&gt; menu), to try to make the search yield a relevant result as often as possible.</p>
<h3>Reverse Engineering a command.</h3>
<p>Sometimes you have a command in an existing template which has some parameters omitted and you would like to supply some or all of the missing parameters.  <em>ChooseFromDataSource </em>and <em>IncludeDataSourceData</em> are good examples of this, as they have quite a few optional parameters.  Instead of re-typing (or getting the Command Editor to re-type) the command from scratch, the entire command, including merge field delimiters (i.e. &lt;&lt; and &gt;&gt;) can be selected and then &lt;key&gt; pressed.  XpressDox will then do its best to reproduce the original wizard which would have been used for the command, with the parameters in the correct places and the optional parameters given reasonable suggestions.</p>
<p>This feature can also be done while inputting a new command, where you have entered some or most of it and can&#8217;t remember how to continue:  just close it off with a closing parenthesis and optionally the end merge field delimiters (&gt;&gt;) and select the entire command (and delimiters) and press &lt;key&gt;.</p>
<h3>Special features.</h3>
<p>It is permissible to press &lt;key&gt; at any point in the document, but XpressDox tries to determine from the context what the author might want.  In particular, if the character immediately to the left of the Word cursor is either a comma or an opening parenthesis (bracket), then XpressDox will infer that the cursor is already in the middle of a command.  Then, any command or data element which is selected in the Command Editor will be inserted into the template without the enclosing merge field delimiters (&lt;&lt; and &gt;&gt;) and followed by a comma.</p>
<p>This is particularly useful when entering commands such as the <em>Tab</em> command which accepts multiple data element names as its list of parameters.  The way a <em>Tab</em> command would be entered would be to type <code>&lt;&lt;Tab(Tab Caption,</code> and then press &lt;key&gt;.  The Command Editor will present a list of commands and data elements, and each data element selected will be inserted into the template, followed by a comma, and the focus will be left in the Command Editor, so that the next data element can be selected.  When the last has been selected, the template author just presses &lt;<em>Escape</em>&gt; and deletes the last comma in the command and finishes the command off with <code>)&gt;&gt;</code>.</p>
<h3>The &lt;Right Click&gt; Menu</h3>
<p>The items in this menu are fairly self explanatory.  Two of the very useful ones are the Wizard and Example menus.  Most commands will have at least on Example available and many have a choice of Wizards.</p>
<h3>The Toolbar Buttons &#8211; the Upper Toolbar</h3>
<p>The upper toolbar has buttons on it that govern the global functioning of the Command Editor.  From left to right their functions are:</p>
<ol>
<li>Toggle whether results of the Command Editor are enclosed in &lt;&lt; and &gt;&gt; delimiters when selected.  This button is checked by default, but will be &#8220;unchecked&#8221; automatically in situations where &lt;key&gt; is pressed and the character immediately to the left of the cursor is a comma or opening parenthesis &#8211; as described in the discussion on the <em>Tab</em> command above.</li>
<li>The second button is invisible by default and becomes visible when the first button is &#8220;unchecked&#8221; &#8211; when that first button is unchecked it means that the Command Editor results are NOT enclosed in &lt;&lt; and &gt;&gt; (which is what happens in the <em>Tab </em>example above).  By default this second button is checked.  This means that when a result is inserted into the template, it will be followed by a comma (hence the icon on that button being a comma). If this second button is unchecked by the user, then Command Editor results are inserted into the template neither enclosed in &lt;&lt; and &gt;&gt; nor followed by a comma.  This can be very useful if you are changing the names of data elements in an existing template &#8211; just select the old data element, and double-click on the new data element name in the Command Editor.  As long as this second button is visible and unchecked, the result will be the renaming of the old data element.</li>
<li>The third button is the Template Painter &#8211; this colors the various merge fields in the template, highlighting the <em>block </em>fields (<em>if</em>, <em>ForEach</em>, <em>Else </em>and <em>End</em>)<em> </em>in different colors to show their nesting levels.</li>
<li>The fourth button provides access to Template Author Tools.</li>
</ol>
<h3>The Toolbar Buttons &#8211; the Lower Toolbar</h3>
<p>The lower toolbar buttons govern the appearance of the command/data element list in the Command Editor.  The left two buttons toggle between an alphabetic list and a list by category.  The right hand two buttons are the filters: allowing either only commands to be shown, or only data elements, or both.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/reference/template-authors-toolkit/' rel='bookmark' title='Permanent Link: The Template Author&#8217;s Toolkit'>The Template Author&#8217;s Toolkit</a></li>
<li><a href='http://www.xpressdox.com/help/reference/caption-command/' rel='bookmark' title='Permanent Link: Caption command: provide a useful name for data capture'>Caption command: provide a useful name for data capture</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/capturelater/' rel='bookmark' title='Permanent Link: The CaptureLater Command'>The CaptureLater Command</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-2-1-3-1/' rel='bookmark' title='Permanent Link: Version 2.1.3.1 (2009-07-27)'>Version 2.1.3.1 (2009-07-27)</a></li>
<li><a href='http://www.xpressdox.com/help/reference/setinitialvalue/' rel='bookmark' title='Permanent Link: The SetInitialValue Command'>The SetInitialValue Command</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/command-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concatenating strings</title>
		<link>http://www.xpressdox.com/help/cookbook/concatenating-strings/</link>
		<comments>http://www.xpressdox.com/help/cookbook/concatenating-strings/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 13:33:24 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[concat]]></category>
		<category><![CDATA[SetV]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2507</guid>
		<description><![CDATA[There are times when it is necessary to concatenate the values of data elements, variables and/or hard-coded strings together to form a value which is then stored in a variable.  The concat function does this.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/concatenating-strings/" title="Permanent link to Concatenating strings"><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 Concatenating strings" /></a>
</p><h3>A pluralising example</h3>
<p>Suppose you have a need to create an XpressDox Variable which will contain either a singular or plural from a data element.  Using the example of a Will in <a title="Working with repeated elements" href="http://www.xpressdox.com/help/cookbook/working-with-repeated-elements /" target="_self">Working with repeated elements</a>, we might want to use the word &#8220;child&#8221; or &#8220;children&#8221; in many places, and not want to use &lt;&lt;When(count(Child)&#8230;&gt;&gt; everywhere, but rather use a variable, e.g. &lt;&lt;GetV(&#8216;childword&#8217;)&gt;&gt;.</p>
<p>There are a number of ways of setting the variable &#8220;childword&#8221; to the required value, but here is one that makes use of the <em>concat</em> function inside a &lt;&lt;SetV&gt;&gt; to concatenate the suffix &#8220;ren&#8221; to the word &#8220;child&#8221; when the number of Child data  elements is greater than one:</p>
<p><code>&lt;&lt;SetV('childword','child')&gt;&gt;<br />
&lt;&lt;If(count(Child) &gt; 1)&gt;&gt;<br />
&lt;&lt;SetV('childword',concat(GetV('childword'),'ren'))&gt;&gt;<br />
&lt;&lt;End()&gt;&gt;<br />
</code></p>
<p>Thereafter any execution of <code>&lt;&lt;GetV('childword')&gt;&gt;</code> will put the correct variation of &#8220;child&#8221; or &#8220;children&#8221; into the merged document.</p>
<h3>A file path example</h3>
<p>Another use of the concat function would be to construct a file path given its constitutents.  For example, suppose the drive, folder and file name are located in three separate data elements.  Setting a variable to contain the full file path would look like this:<br />
<code>&lt;&lt;SetV('FullFilePath',concat(Drive,'\',Folder,'\',FileName))&gt;&gt;</code></p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/repeating-data-part-2/' rel='bookmark' title='Permanent Link: Working with Repeating Data – Part 2'>Working with Repeating Data – Part 2</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/test-for-any-or-all/' rel='bookmark' title='Permanent Link: Test for Any or All repeated items meeting criteria'>Test for Any or All repeated items meeting criteria</a></li>
<li><a href='http://www.xpressdox.com/help/reference/syntax-notes/' rel='bookmark' title='Permanent Link: Notes on XpressDox syntax'>Notes on XpressDox syntax</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/using-variables/' rel='bookmark' title='Permanent Link: Using variables'>Using variables</a></li>
<li><a href='http://www.xpressdox.com/help/reference/variables/' rel='bookmark' title='Permanent Link: Using and storing variables'>Using and storing variables</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/concatenating-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test for Any or All repeated items meeting criteria</title>
		<link>http://www.xpressdox.com/help/cookbook/test-for-any-or-all/</link>
		<comments>http://www.xpressdox.com/help/cookbook/test-for-any-or-all/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 13:36:07 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Repeating Data]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2388</guid>
		<description><![CDATA[It is sometimes necessary to test whether at least one (Any) of a group of repeated items meets a particular set of criteria, and also to test whether All of the group meet those criteria.  This article discusses how to construct those tests.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/test-for-any-or-all/" title="Permanent link to Test for Any or All repeated items meeting criteria"><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 Test for Any or All repeated items meeting criteria" /></a>
</p><p>Suppose you are preparing a template for a Will, where various provisions need to be made for the children of the testator.  The children will then be represented on the template as a repeating item, and in various parts of the template, tests would be made to determine whether any or all of the children meet the necessary criteria.</p>
<p>Somewhere in the template the children would be listed, perhaps like this:</p>
<blockquote><p>The children are:<br />
<code>&lt;&lt;ForEach(Child)&gt;&gt;</code><br />
Name: <code>&lt;&lt;Name&gt;&gt;</code><br />
Gender: <code>&lt;&lt;Gender&gt;&gt;</code><br />
Age:<code> &lt;&lt;Age&gt;&gt;</code><br />
<code>&lt;&lt;End()&gt;&gt;</code>
</p></blockquote>
<p>You may then have a paragraph in the Will which needs to be included only if any (or in other words least one) of the children is a minor (i.e. age less than 18).  The test for &#8220;Any&#8221; would look like this:</p>
<blockquote><p><code>&lt;&lt;If(count(Child[Age &lt; 18]) &gt; 0&gt;&gt;</code><br />
The minor children must be blah blah &#8230;<br />
<code>&lt;&lt;End()&gt;&gt;</code>
</p></blockquote>
<p>Another paragraph is required only if ALL the children are minors.  This test would look like this:</p>
<blockquote><p>
<code>&lt;&lt;If(count(Child[Age &lt; 18]) = count(Child))&gt;&gt;</code><br />
blah &#8230;<br />
<code>&lt;&lt;End()&gt;&gt;</code></p></blockquote>
<p class="note">See the Cookbook article <a title="Working with repeated elements" href="http://www.xpressdox.com/help/cookbook/working-with-repeated-elements /" target="_self">Working with repeated elements</a> for more information on repeated data elements.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/working-with-repeated-elements/' rel='bookmark' title='Permanent Link: Working with repeated elements'>Working with repeated elements</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/repeating-data-part-2/' rel='bookmark' title='Permanent Link: Working with Repeating Data – Part 2'>Working with Repeating Data – Part 2</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/doc-per-repeated-item-filter/' rel='bookmark' title='Permanent Link: Document per Repeated Item – with Filter'>Document per Repeated Item – with Filter</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/document-per-repeated-item/' rel='bookmark' title='Permanent Link: Document per Repeated Item'>Document per Repeated Item</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/concatenating-strings/' rel='bookmark' title='Permanent Link: Concatenating strings'>Concatenating strings</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/test-for-any-or-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trouble shooting missing pictures in documents</title>
		<link>http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/</link>
		<comments>http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 15:22:20 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Trouble Shooting]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2369</guid>
		<description><![CDATA[Normally pictures, logos, etc., are handled without problems by XpressDox.  But sometimes the pictures go missing from the merged document and are replaced by a red X in a box.  This recipe discusses why this can happen and gives some advice on how to correct the situation.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/" title="Permanent link to Trouble shooting missing pictures in documents"><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 Trouble shooting missing pictures in documents" /></a>
</p><p>Pictures, logos, etc., are normally handled seamlessly by XpressDox.</p>
<p>Sometimes, though, pictures can go missing from the document when it is merged.</p>
<p>This can happen if the same picture occurs more than once in a template.  It seems that Word optimizes its memory usage by storing this picture once in the document, as a kind of master version of the picture, and then referring to this master version from the other places in the document where it&#8217;s required.  Which is quite clever, really.</p>
<p>This can lead to strange behaviour if the first occurrence of the picture in the document is made dependant on some or other condition.  If that condition works out to a &#8220;false&#8221; value when the template is merged, and the master picture is then excluded from the merged document, then the other places that require this picture will not be able to find the master.  Usually what happens is that Word puts a square with a red X in it where you would like the picture to be.</p>
<p>The way around this is to make sure that the first occurrence of the repeated picture always appears in the merged result.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/' rel='bookmark' title='Permanent Link: Trouble shooting Conditional Capture'>Trouble shooting Conditional Capture</a></li>
<li><a href='http://www.xpressdox.com/help/reference/trouble-shooting-startup/' rel='bookmark' title='Permanent Link: Trouble Shooting XpressDox Startup'>Trouble Shooting XpressDox Startup</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/' rel='bookmark' title='Permanent Link: Trouble shooting Ends and Elses'>Trouble shooting Ends and Elses</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/one-template-many-datasets/' rel='bookmark' title='Permanent Link: 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>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trouble shooting Conditional Capture</title>
		<link>http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/</link>
		<comments>http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:32:07 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Conditional Capture]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2324</guid>
		<description><![CDATA[Conditional Capture can sometimes result in unexpected behaviour, where data elements either are unexpectedly removed from the data capture interview, or appear on the interviewwhen they shouldn't.  This recipe gives some tips on how to trouble shoot these situations.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/" title="Permanent link to Trouble shooting Conditional Capture"><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 Trouble shooting Conditional Capture" /></a>
</p><p>Conditional Capture refers to the feature in XpressDox which hides fields in the data capture interview if the conditions for rendering that field into the merged document are not met.</p>
<p>Take the following snippet of a template as an example:</p>
<blockquote><p><code>&lt;&lt;ChooseFromRdbList(Married,Y,N)&gt;&gt;</code><br />
<code>&lt;&lt;If(Married='Y')&gt;&gt;</code><br />
Spouse’s Name: <code>&lt;&lt;SpouseFirstNames&gt;&gt;</code> <code>&lt;&lt;SpouseSurname&gt;&gt;</code><br />
<code>&lt;&lt;End()&gt;&gt;</code></p></blockquote>
<p>When this template is run, the interview will include the radio button list with the Y button checked (because the first value in a <em>ChooseFromRdbList</em> is always the default value).  Because the value of <em>Married</em> is &#8216;Y&#8217;, the <em>If</em> command evaluates to true and so there will be fields for the capture of <em>SpouseFirstNames</em> and <em>SpouseSurname</em> on the interview.</p>
<p>As soon as the user running the template clicks the N button in the radio button list, then the <em>SpouseFirstNames</em> and <em>SpouseSurname</em> fields will disappear from the dialog.  This is <strong>Conditional Capture</strong>.</p>
<h3>Some Typical Scenarios</h3>
<p>Sometimes this feature can appear to be working incorrectly.  This can be for a number of reasons, typically:</p>
<ul>
<li>Setting a value in a <em>Choose&#8230;</em> command but testing against another data element:  e.g. in the above example, if the <em>If</em> command were <code>&lt;&lt;If(married = 'Y')&gt;&gt;</code> then the result will always be false (because the data element being tested is <em>married</em>, with a lower case “m”).  This is because <em>Married</em> and <em>married</em> are two different data elements, because data element names are case sensitive. So in this case the data element <em>married</em> will never be equal to &#8216;Y&#8217;.</li>
<li>Similar to the above, but testing against the incorrect value:  e.g. if the <em>If</em> command above were to read <code>&lt;&lt;If(Married = 'Yes')&gt;&gt;</code> or <code>&lt;&lt;If(Married = 'y')&gt;&gt;</code> or <code>&lt;&lt;If(Married = Y)&gt;&gt;</code>.  Notice that in the last case, the test is performed against the values of the data element <em>Married</em> and the <strong>data element Y</strong>.  This is because the Y is not in quotes and so is regarded as the name of a data element, not a string literal with the value &#8216;Y&#8217;.</li>
<li>Sometimes a data element can be subject to more than one condition, in which case the data element might always appear on the interview.</li>
</ul>
<h3>Show Hidden Fields</h3>
<p>When conditional capture causes some fields to be hidden in the interview, then a checkbox labelled <em>Show Hidden Fields</em> will appear at the bottom of the interview screen.  When this is checked, XpressDox will display the hidden fields, but in a disabled, read-only state.</p>
<p>If you click on a disabled field, then the condition which governs that field will be shown in the Help area.</p>
<p>Often just inspecting that condition will be sufficient to detect any errors or misperceptions.</p>
<h3>&lt;Ctrl-Alt&gt;</h3>
<p>When the keyboard focus is on a non-hidden field, then if you press the <em>Ctrl</em> and <em>Alt</em> keys simultaneously, XpressDox will display the data element name (in case it is different to the caption) as well as the condition applying to that field.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/reference/conditional-capture/' rel='bookmark' title='Permanent Link: Conditional Capture'>Conditional Capture</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/' rel='bookmark' title='Permanent Link: Trouble shooting missing pictures in documents'>Trouble shooting missing pictures in documents</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/' rel='bookmark' title='Permanent Link: Trouble shooting Ends and Elses'>Trouble shooting Ends and Elses</a></li>
<li><a href='http://www.xpressdox.com/help/reference/trouble-shooting-startup/' rel='bookmark' title='Permanent Link: Trouble Shooting XpressDox Startup'>Trouble Shooting XpressDox Startup</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/dialog-layout-tips/' rel='bookmark' title='Permanent Link: Data capture interview layout tips'>Data capture interview layout tips</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trouble shooting Ends and Elses</title>
		<link>http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/</link>
		<comments>http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 09:22:49 +0000</pubDate>
		<dc:creator>Peter Tuffin</dc:creator>
				<category><![CDATA[XpressDox Cookbook]]></category>
		<category><![CDATA[Else]]></category>
		<category><![CDATA[End]]></category>

		<guid isPermaLink="false">http://www.xpressdox.com/?p=2312</guid>
		<description><![CDATA[In complex templates, the balancing of End and Else commands with the matching If or ForEach can become difficult.  This recipe explains how to use the Template Painter and the Debug command.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/" title="Permanent link to Trouble shooting Ends and Elses"><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 Trouble shooting Ends and Elses" /></a>
</p><p>In complex templates, the balancing of <code>&lt;&lt;End()&gt;&gt;</code> and <code>&lt;&lt;Else()&gt;&gt;</code> commands with the matching <code>&lt;&lt;If()&gt;&gt;</code> or <code>&lt;&lt;ForEach&gt;&gt;</code> can become difficult.</p>
<h3>The Template Painter</h3>
<p>The Template Painter tool can be very useful for this.  The Template Painter can be invoked either from the Common Tools menu (Word 2007) or the Template Author toolbar (Word 2003) or from the toolbar on the Template Author’s Toolkit (TAT).</p>
<p>The Template Painter will highlight matching start and end block commands (<em>If</em> and <em>ForEach</em> commands are known as <em>block commands</em>) with the same color, and at the same time format all the merge fields with the font and color which can be set using the <em>Define the font and colour of merge fields</em> button on the TAT (this feature in the TAT also enables you to change the colors that the Painter applies to the start and end block commands).</p>
<p>In addition, the Painter will notify you when there are missing or extra (floating) <em>End</em> commands.  Floating <em>End</em> commands are highlighted with the text &lt;========.  The floating <em>End</em> command is not removed, because it might in fact be the correct command and an <em>End</em> earlier in the template might be the floating one.</p>
<h3>Running a Template &#8211; the <em>Debug</em> command</h3>
<p>When a template is run, XpressDox will check for missing and floating <em>End</em> commands as well as floating <em>Else</em> commands.</p>
<p>Wherever possible, the error message warning about one of these situations will give some context within the document where the relevant command is, so that you can find it easily and correct the situation.</p>
<p>But sometimes it’s not possible for XpressDox to provide a context.  When this happens, XpressDox will recommend that you use the <code>&lt;&lt;Debug()&gt;&gt;</code> command.  When you put the <em>Debug</em> command somewhere (preferably right at the top) in the template, then if there is a floating <em>End</em> or <em>Else</em> command in the template after that <em>Debug</em> command, then XpressDox will highlight that floating command in the text of the merged document.</p>
<p>When there is a <em>Debug</em> command in a template, XpressDox will put a big ugly warning at the top of the merged document warning about the presence of the <em>Debug</em> command, so once there are no more floating commands, the <em>Debug</em> command should be removed.</p>


<p>Related posts:<ul><li><a href='http://www.xpressdox.com/help/cookbook/troubleshoot-missing-pictures/' rel='bookmark' title='Permanent Link: Trouble shooting missing pictures in documents'>Trouble shooting missing pictures in documents</a></li>
<li><a href='http://www.xpressdox.com/help/cookbook/trouble-shooting-conditional/' rel='bookmark' title='Permanent Link: Trouble shooting Conditional Capture'>Trouble shooting Conditional Capture</a></li>
<li><a href='http://www.xpressdox.com/help/reference/trouble-shooting-startup/' rel='bookmark' title='Permanent Link: Trouble Shooting XpressDox Startup'>Trouble Shooting XpressDox Startup</a></li>
<li><a href='http://www.xpressdox.com/help/reference/using-block-commands/' rel='bookmark' title='Permanent Link: Using block commands in XpressDox Docussembly&trade;'>Using block commands in XpressDox Docussembly&trade;</a></li>
<li><a href='http://www.xpressdox.com/help/new/version-2-3-1/' rel='bookmark' title='Permanent Link: Version 2.3.1 (2010-03-03)'>Version 2.3.1 (2010-03-03)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.xpressdox.com/help/cookbook/trouble-shooting-end-else/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
