<?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>Parth on Livecycle &#187; LiveCycle Components</title>
	<atom:link href="http://blog.pandyaparth.com/category/livecycle-es/livecycle-components/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pandyaparth.com</link>
	<description>aka - LiveCycle Karma (Personal blog on LiveCycle, Adobe enterprise technologies and innovation)</description>
	<lastBuildDate>Sun, 05 Feb 2012 23:15:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Conditional set value using XPath</title>
		<link>http://blog.pandyaparth.com/2009/11/conditional-set-value-using-xpath/</link>
		<comments>http://blog.pandyaparth.com/2009/11/conditional-set-value-using-xpath/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 06:07:25 +0000</pubDate>
		<dc:creator>Parth Pandya</dc:creator>
				<category><![CDATA[LiveCycle Components]]></category>
		<category><![CDATA[LiveCycle ES]]></category>
		<category><![CDATA[LiveCycle ES2]]></category>
		<category><![CDATA[Workbench]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XPath]]></category>
		<category><![CDATA[Innovation]]></category>
		<category><![CDATA[XPath expression]]></category>

		<guid isPermaLink="false">http://blog.pandyaparth.com/?p=146</guid>
		<description><![CDATA[In my quest to use XPath functions &#38; expressions more efficiently in LiveCycle I managed to achieve &#8216;conditional set value&#8217; yesterday. Example scenarios: Add some text to email body if some condition is true/false. Add some text into T&#38;Cs if certain product is selected. In a generic/single Email or Set Value step you need to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS50d2VldG1lbWUuY29tL3NoYXJlP3VybD1odHRwJTNBJTJGJTJGYmxvZy5wYW5keWFwYXJ0aC5jb20lMkYyMDA5JTJGMTElMkZjb25kaXRpb25hbC1zZXQtdmFsdWUtdXNpbmcteHBhdGglMkY="><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pandyaparth.com%2F2009%2F11%2Fconditional-set-value-using-xpath%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In my quest to use XPath functions &amp; expressions more efficiently in LiveCycle I managed to achieve &#8216;conditional set value&#8217; yesterday.</p>
<h3>Example scenarios:</h3>
<ul>
<li>Add some text to email body if some condition is true/false.</li>
<li>Add some text into T&amp;Cs if certain product is selected.</li>
<li>In a generic/single Email or Set Value step you need to construct a big block of text. eg. Offer letter with certain paragraphs based on few conditions.</li>
</ul>
<h3>Approach 1: The usual way (or one of the usual ways):</h3>
<p>An orchestration in Workbench with <span style="color: #ff0000;">few setValue steps</span> and<span style="color: #ff0000;"> few conditional routes</span> to add/append the desired text to existing text.</p>
<p>And these steps need to be in certain order.</p>
<h3>Approach 2: The XPath trick</h3>
<p>I used <span style="color: #0000ff;">substring()</span> and<span style="color: #0000ff;"> number()</span> function with pure <span style="color: #0000ff;">XPath expression</span> to construct conditional set value. See the usage below.</p>
<h3>Example:</h3>
<p>Consider a requirement in which you wish to send an email with few extra lines added to it if product A is ordered. And if contract term is 12 months then we need to add another T&amp;C statement in the email body.</p>
<p>Let&#8217;s implement that with both approaches&#8230;</p>
<h4>Approach 1: Few set value step and routing conditions to set process variables that get used in email body.</h4>
<h5>Process Diagram:</h5>
<div id="attachment_148" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cucGFuZHlhcGFydGguY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA5LzExL0FwcHJvYWNoMS5QTkc="><img class="size-medium wp-image-148" title="LC Set Value approach" src="http://blog.pandyaparth.com/wp-content/uploads/2009/11/Approach1-300x159.PNG" alt="Set Value - Route condition approach" width="300" height="159" /></a><p class="wp-caption-text">Set Value - Route condition approach</p></div>
<h5>Email body:</h5>
<blockquote><p>Dear Provisioning Team,</p>
<p>Please send the below details to John.</p>
<p>System:{$ /process_data/@System $}<br />
Agent Name:{$ /process_data/@Agentname $}<br />
Product ordered: {$ /process_data/@Product $}</p>
<p><span style="color: #ff0000;">{$ /process_data/@ProductAConfigurationDetails $}</span></p>
<p>Terms and Conditions:<br />
blah blah blah from Legal<br />
adf<br />
adf<br />
<span style="color: #ff0000;">{$ /process_data/@TCFor12MonthsContract$}</span><br />
blah<br />
blah</p>
<p>regards,<br />
BOH Team</p></blockquote>
<h4>Approach 2: Conditional set value with XPath</h4>
<h5>Process diagram:</h5>
<p><a href="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cucGFuZHlhcGFydGguY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA5LzExL0FwcHJvYWNoMi5QTkc="><img class="alignnone size-medium wp-image-153" title="Set Value XPath approach" src="http://blog.pandyaparth.com/wp-content/uploads/2009/11/Approach2-300x123.PNG" alt="Set Value XPath approach" width="300" height="123" /></a></p>
<h5>Email Body</h5>
<blockquote><p>Dear Provisioning Team,</p>
<p>Please send the below details to John.</p>
<p>System:{$ /process_data/@System $}<br />
Agent Name:{$ /process_data/@Agentname $}<br />
Product ordered: {$ /process_data/@Product $}<br />
<span style="color: #ff6600;"><br />
<span style="color: #0000ff;">{$ substring(&#8216;This is where the actual text gets put about the product configuration&#8217;,<br />
50000000 * (number(/process_data/@Product !=&#8217;Product A&#8217;))<br />
) $}</span></span></p>
<p>Terms and Conditions:<br />
blah blah blah from Legal<br />
adf<br />
adf<span style="color: #339966;"><br />
<span style="color: #0000ff;">{$ substring(&#8217;12 Months T&amp;C content is written here or can be xpath expression&#8217;,<br />
50000000 * (number(/process_data/@ContractLength !=&#8217;12&#8242;))<br />
) $}</span></span><br />
blah<br />
blah</p>
<p>regards,<br />
BOH Team</p></blockquote>
<h3>Explanation:</h3>
<ul>
<li>The above expression marked in blue puts the text in email body if the condition at the end of it fulfills.</li>
<li>By moving this logic into the email step itself I could clean up the process design significantly. I believe that LC is too good to do data transformation but common&#8230;few set value and few conditional routes for a simple text insertion?? I reckon the XPath trick gives much more cleaner approach to solve this.</li>
<li>First thing to notice in the expression is the use of a large number <span style="color: #ff6600;"><span style="color: #0000ff;">50000000</span></span> . This is used to return blank substring value if the expression is false. Please adjust if your input text can be larger than this.</li>
<li>Second thing to notice is the use of comparison operator. I wanted to have 0 (zero) value for substring start value if condition is true. Boolean true is 1 so I&#8217;m using opposite operator. Eg. if(product=&#8221;Product A&#8221;) is represented as product!=&#8221;Product A&#8221;</li>
</ul>
<p>As this is an XPath based expression we can use it in any LC component. I tried implementing if-else clause as well but that didn&#8217;t turn out well.</p>
<p>If you managed to read through this much then I&#8217;m sure you would love to see the <span style="color: #ff0000;">undocumented &#8216;and&#8217; &#8216;or&#8217; keyword usage in XPath expression</span>. I found that while experimenting and it&#8217;s an instant hit among few of my fellow LC users. <a href="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cucGFuZHlhcGFydGguY29tLzIwMDkvMDcvaW50cm9kdWNpbmctbGMta2V5d29yZHMtbG9naWNhbC1vcGVyYXRvcnMtYW5kb3Iv" target=\"_self\">It can be found here</a>..</p>
<p>Let me know if you find this useful!!!!</p>
 <img src="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=146" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.pandyaparth.com/2009/11/conditional-set-value-using-xpath/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Form Pre-populate via Render service (delayed)</title>
		<link>http://blog.pandyaparth.com/2009/06/form-pre-populate-via-render-service-delayed/</link>
		<comments>http://blog.pandyaparth.com/2009/06/form-pre-populate-via-render-service-delayed/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 07:30:52 +0000</pubDate>
		<dc:creator>Parth Pandya</dc:creator>
				<category><![CDATA[LiveCycle Components]]></category>
		<category><![CDATA[LiveCycle ES]]></category>
		<category><![CDATA[Workspace]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[dataDoc]]></category>
		<category><![CDATA[Forms pre-population]]></category>
		<category><![CDATA[Orchestration]]></category>
		<category><![CDATA[Render Service]]></category>
		<category><![CDATA[Workbench]]></category>

		<guid isPermaLink="false">http://livecyclekarma.wordpress.com/?p=110</guid>
		<description><![CDATA[Hi All, I was suppose to post easy techniques on how to pre-populate forms via LiveCycle&#8217;s Render service but unfortunately it is taking longer than what I expected. This is the story so far&#8230; Please comment if you are aware of this and enlighten me around the changed behavior. Background: I used the customized render [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS50d2VldG1lbWUuY29tL3NoYXJlP3VybD1odHRwJTNBJTJGJTJGYmxvZy5wYW5keWFwYXJ0aC5jb20lMkYyMDA5JTJGMDYlMkZmb3JtLXByZS1wb3B1bGF0ZS12aWEtcmVuZGVyLXNlcnZpY2UtZGVsYXllZCUyRg=="><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pandyaparth.com%2F2009%2F06%2Fform-pre-populate-via-render-service-delayed%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hi All,</p>
<p>I was suppose to post easy techniques on how to pre-populate forms via LiveCycle&#8217;s Render service but unfortunately it is taking longer than what I expected. This is the story so far&#8230; Please comment if you are aware of this and enlighten me around the changed behavior.</p>
<h3>Background:</h3>
<p>I used the customized render service till LC 8.0.1 SP2 and what we get in dataDoc variable of the Render service is xdp data which had the whole form specific XML structure. But I&#8217;m finding that in LiveCycle 8.2 SP2 the dataDoc contains the xdp data but ONLY the Root element of form data is present.</p>
<p>The issue: This results in stalled operations (exception) as the elements that I want to populate does not exist.</p>
<h3>The strange thing:</h3>
<p>The most strange thing that I have seen is related to where the &#8216;caller&#8217; orchestration was developed. So if your orchestration which has xfaForm variable was created on LC 8.0.1 then the dataDoc variable will have the xdp data with the whole and empty form data section in it. BUT&#8230;.. if you touch that variable or re-create that xfaForm variable on LC 8.2 then you&#8217;ll start getting the blank form xml section in xdp data (of dataDoc) variable of render service.</p>
<p>Please let me know if anyone has seen this before and knows if this was intentional in LC 8.2 or it is a reported/unreported bug.</p>
<p>stay tuned for the pre-population.. I&#8217;ve decided to post a series of two articles to discuss the strategy that I think can work nicely.</p>
 <img src="http://blog.pandyaparth.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=110" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.pandyaparth.com/2009/06/form-pre-populate-via-render-service-delayed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

