<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Kevin Akselrod's Blog</title>
	<atom:link href="http://kevinakselrod.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kevinakselrod.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 19 May 2010 00:14:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kevinakselrod.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kevin Akselrod's Blog</title>
		<link>http://kevinakselrod.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kevinakselrod.wordpress.com/osd.xml" title="Kevin Akselrod&#039;s Blog" />
	<atom:link rel='hub' href='http://kevinakselrod.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Deduplication of Data in SQL Server (2005+) Using PARTITION BY</title>
		<link>http://kevinakselrod.wordpress.com/2010/05/19/deduplication-of-data-in-sql-server-2005-using-partition-by/</link>
		<comments>http://kevinakselrod.wordpress.com/2010/05/19/deduplication-of-data-in-sql-server-2005-using-partition-by/#comments</comments>
		<pubDate>Wed, 19 May 2010 00:14:32 +0000</pubDate>
		<dc:creator>Kevin Akselrod</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Duplication]]></category>
		<category><![CDATA[PARTITION BY]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://kevinakselrod.wordpress.com/?p=67</guid>
		<description><![CDATA[The SQL PARTITION BY clause allows you to partition your result set based on pretty much anything you want.  Rather than expounding too much, I&#8217;m going to dive right into a simple toy example. Let&#8217;s say that you have a table that holds your shopping list: CREATE TABLE [#DuplicatedData] ( [ID] INT, [MyData] NVARCHAR(255), [Date] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=67&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The SQL PARTITION BY clause allows you to partition your result set based on pretty much anything you want.  Rather than expounding too much, I&#8217;m going to dive right into a simple toy example.</p>
<p>Let&#8217;s say that you have a table that holds your shopping list:</p>
<pre>  CREATE TABLE [#DuplicatedData]
  (
	  [ID]		INT,
	  [MyData]	NVARCHAR(255),
	  [Date]	DATETIME
  )</pre>
<p>You and your girlfriend both have an application on your phones that lets you enter data into this shopping list.  However, you don&#8217;t coordinate every single thing you enter, so you&#8217;re bound to have some duplication sometimes as each of you realizes that, hey, you&#8217;re out of potatoes.  So, on January 1, you both enter that you need potatoes, and you further enter that you need celery:</p>
<pre>  INSERT INTO [#DuplicatedData] VALUES (1, 'Potatoes', '1/1/2010 5:35:04 PM')
  INSERT INTO [#DuplicatedData] VALUES (2, 'Celery', '1/1/2010 5:36:12 PM')
  INSERT INTO [#DuplicatedData] VALUES (3, 'Potatoes', '1/1/2010 6:02:38 PM')</pre>
<p>A few days later, you&#8217;ve used up your potatoes, so you need more:</p>
<pre>  INSERT INTO [#DuplicatedData] VALUES (4, 'Potatoes', '1/4/2010 1:20:09 PM')</pre>
<p>When you went to print out your list on January 2, you didn&#8217;t want to see Potatoes twice.. and when you look back on your shopping habits, you also don&#8217;t want to see Potatoes twice for January 1.  So you decide that, while maybe it&#8217;s possible once in a while, it&#8217;s probably pretty rate that you will need potatoes more than once in a day, so you&#8217;re going to remove any entries that are for the same item on the same day.  You&#8217;ll only take the latest entry in a day for any particular item.  But how?</p>
<p>That&#8217;s where the beauty of PARTITION BY comes into play.  Let&#8217;s take a look at this query:</p>
<pre>  SELECT
	  ROW_NUMBER() OVER(PARTITION BY [MyData], CONVERT(VARCHAR, [Date], 101) ORDER BY [ID] DESC) AS [RowNum],
	  *
  FROM
	  [#DuplicatedData]</pre>
<p>We are breaking up the data by item and then by date (but not time) and ordering to get the latest entries showing up first, then we are getting a row number to identify the order <strong>in each partition</strong> of the items.  The results from this query look like this:</p>
<pre>  1	  2	  Celery	2010-01-01 17:36:12.000
  1	  3	  Potatoes	2010-01-01 18:02:38.000
  2	  1	  Potatoes	2010-01-01 17:35:04.000
  1	  4	  Potatoes	2010-01-04 13:20:09.000</pre>
<p>The Potatoes entries on January 1 have been grouped together and numbered 1 and 2, whereas the others are each in their own partitions and are numbered 1.  Once we have this, it&#8217;s trivial to get the data that we want:</p>
<pre>  SELECT [MyData], [Date] FROM
	  (
		  SELECT
			  ROW_NUMBER() OVER(PARTITION BY [MyData], CONVERT(VARCHAR, [Date], 101) ORDER BY [ID] DESC) AS [RowNum],
			  *
		  FROM
			  [#DuplicatedData]
	  ) AS [Sub]
  WHERE
	  [RowNum] = 1
  ORDER BY
	  [Date] ASC</pre>
<p>Results:</p>
<pre>  Celery	2010-01-01 17:36:12.000
  Potatoes	2010-01-01 18:02:38.000
  Potatoes	2010-01-04 13:20:09.000</pre>
<p>Thanks to <strong>Sam Grose</strong> for teaching me pretty much everything in this post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kevinakselrod.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kevinakselrod.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kevinakselrod.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=67&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kevinakselrod.wordpress.com/2010/05/19/deduplication-of-data-in-sql-server-2005-using-partition-by/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88a0f23c98fdb84783bdfceb3c93fe98?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kevinakselrod</media:title>
		</media:content>
	</item>
		<item>
		<title>New web application.</title>
		<link>http://kevinakselrod.wordpress.com/2010/04/13/new-web-application/</link>
		<comments>http://kevinakselrod.wordpress.com/2010/04/13/new-web-application/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 02:11:11 +0000</pubDate>
		<dc:creator>Kevin Akselrod</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kevinakselrod.wordpress.com/?p=62</guid>
		<description><![CDATA[I&#8217;ve created a new blog to track my efforts in creating a brand-new web application for personal use.  It can be found here: http://hiddensanctum.wordpress.com/ Now that I&#8217;ve figured out my password for this blog, I will continue to use it to post interesting .NET/SQL finds that do not relate to the above, but I am [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=62&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a new blog to track my efforts in creating a brand-new web application for personal use.  It can be found here:</p>
<p><a href="http://hiddensanctum.wordpress.com/">http://hiddensanctum.wordpress.com/</a></p>
<p>Now that I&#8217;ve figured out my password for this blog, I will continue to use it to post interesting .NET/SQL finds that do not relate to the above, but I am no longer working in SharePoint, so I won&#8217;t be posting any more SharePoint entries.  (Not that I&#8217;ve posted a lot of entries at all so far.)</p>
<p>Time is slim, but I&#8217;m hoping to be able to make a post now and again that may help someone else out there.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kevinakselrod.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kevinakselrod.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kevinakselrod.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=62&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kevinakselrod.wordpress.com/2010/04/13/new-web-application/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88a0f23c98fdb84783bdfceb3c93fe98?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kevinakselrod</media:title>
		</media:content>
	</item>
		<item>
		<title>Ensuring repeating fields are not blank in InfoPath 2007</title>
		<link>http://kevinakselrod.wordpress.com/2009/09/10/ensuring-repeating-fields-are-not-blank-in-infopath-2007/</link>
		<comments>http://kevinakselrod.wordpress.com/2009/09/10/ensuring-repeating-fields-are-not-blank-in-infopath-2007/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 20:48:10 +0000</pubDate>
		<dc:creator>Kevin Akselrod</dc:creator>
				<category><![CDATA[CAPM]]></category>
		<category><![CDATA[InfoPath]]></category>
		<category><![CDATA[InfoPath 2007]]></category>

		<guid isPermaLink="false">http://kevinakselrod.wordpress.com/?p=32</guid>
		<description><![CDATA[A bit of exciting news before I get to the real post:  Since I&#8217;ve last posted, I&#8217;ve studied for and passed the CAPM exam. Anyway,&#8230; The Situation I am creating a form to track the staffing process at my company.  I have an InfoPath 2007 form that has a repeating table.  This table has two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=32&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A bit of exciting news before I get to the real post:  Since I&#8217;ve last posted, I&#8217;ve studied for and passed the CAPM exam.</p>
<p>Anyway,&#8230;</p>
<p><span style="text-decoration:underline;">The Situation</span></p>
<p>I am creating a form to track the staffing process at my company.  I have an InfoPath 2007 form that has a repeating table.  This table has two fields in it:  a Candidate Name textbox and a Notes attachment.  I want to know when, say, the Notes field has been filled in for every candidate.  So, upon submit, I want to check if all of the Notes fields in the repeating table have been filled in/have attachments in them, and, if they have, I want to populate a value in another field, Date.<span id="more-32"></span></p>
<p><span style="text-decoration:underline;">The Issue</span></p>
<p>So, I created a rule on the Submit button to set the Date field to today&#8217;s date if the Notes field is not blank:</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/rule13.jpg"><img class="aligncenter size-full wp-image-44" title="rule1" src="http://kevinakselrod.files.wordpress.com/2009/09/rule13.jpg?w=700" alt="rule1"   /></a></p>
<p>(The rule checks if the Date field is blank to ensure that the Date field is only filled in the first time the Notes fields are set, not every time the form is submitted.)</p>
<p>This rule meets what I would imagine would make sense &#8211; and also what I&#8217;ve seen other posts telling me to do.  However, this rule exhibits some unexpected behavior.  Let&#8217;s look at a truth table for two instances of the repeating table:</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/tt_isnotblank.png"><img class="aligncenter size-full wp-image-46" title="tt_isNotBlank" src="http://kevinakselrod.files.wordpress.com/2009/09/tt_isnotblank.png?w=700" alt="tt_isNotBlank"   /></a></p>
<p>If even one of the Notes fields is not blank, then &#8220;is not blank&#8221; evaluates to True.  This is not the behavior that I am looking for &#8211; I want only the last column to evaluate to true.  But for a repeating field, if &#8220;is not blank&#8221; is true for one of the individual fields, it evaluates to True for the repeating field.</p>
<p><span style="text-decoration:underline;">The Solution</span></p>
<p>You will notice that the above behavior is reflected in &#8220;is blank&#8221; as well:</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/tt_isblank.png"><img class="aligncenter size-full wp-image-47" title="tt_isBlank" src="http://kevinakselrod.files.wordpress.com/2009/09/tt_isblank.png?w=700" alt="tt_isBlank"   /></a></p>
<p>If &#8220;is blank&#8221; is true for one of the individual fields, &#8220;is blank&#8221; evaluates to True for the repeating field.  Luckily, this is to our advantage:</p>
<p>What we are looking for is the exact opposite of the behavior we notice in &#8220;is blank;&#8221; we want the first three columns to evaluate to False and only the last column to evaluate to True.  To do that, all we need to do is take the &#8220;not&#8221; of the &#8220;is blank&#8221; function:</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/tt_not_isblank.png"><img class="aligncenter size-full wp-image-50" title="tt_not_isBlank" src="http://kevinakselrod.files.wordpress.com/2009/09/tt_not_isblank.png?w=700" alt="tt_not_isBlank"   /></a></p>
<p>This gives us the behavior that we are seeking.  In order to do this in InfoPath, we want to open the Condition for the Rule, set &#8220;Notes is blank,&#8221; then switch &#8220;Notes&#8221; to &#8220;The expression:&#8221;</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/isblank.jpg"><img class="aligncenter size-full wp-image-51" title="isBlank" src="http://kevinakselrod.files.wordpress.com/2009/09/isblank.jpg?w=700" alt="isBlank"   /></a></p>
<p>This will allow you to edit the expression directly.  Just put a &#8220;not()&#8221; around the expression, and you&#8217;re done!</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/09/expression.jpg"><img class="aligncenter size-full wp-image-53" title="expression" src="http://kevinakselrod.files.wordpress.com/2009/09/expression.jpg?w=700" alt="expression"   /></a></p>
<p><span style="text-decoration:underline;"><br />
</span></p>
<p>Thanks go to <strong>g-man</strong> and crew for posting how to not an expression in <a href="http://www.infopathdev.com/forums/p/13138/46532.aspx" target="_blank">this</a> thread on <a href="http://www.infopathdev.com/" target="_blank">InfoPath Dev</a>.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:502px;width:1px;height:1px;">
<table style="border-collapse:collapse;width:169pt;" border="0" cellspacing="0" cellpadding="0" width="223">
<col style="width:64pt;" width="85"></col>
<col style="width:26pt;" span="3" width="34"></col>
<col style="width:27pt;" width="36"></col>
<tbody>
<tr style="height:15pt;">
<td class="xl63" style="height:15pt;width:64pt;" width="85" height="20">Notes1</td>
<td class="xl64" style="border-left:medium none;width:26pt;" width="34"></td>
<td class="xl64" style="border-left:medium none;width:26pt;" width="34">X</td>
<td class="xl64" style="border-left:medium none;width:26pt;" width="34"></td>
<td class="xl64" style="border-left:medium none;width:27pt;" width="36">X</td>
</tr>
<tr style="height:15pt;">
<td class="xl63" style="border-top:medium none;height:15pt;" height="20">Notes2</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;"></td>
<td class="xl64" style="border-top:medium none;border-left:medium none;"></td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">X</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">X</td>
</tr>
<tr style="height:15pt;">
<td class="xl63" style="border-top:medium none;height:15pt;" height="20">is not blank</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">F</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">T</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">T</td>
<td class="xl64" style="border-top:medium none;border-left:medium none;">T</td>
</tr>
</tbody>
</table>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kevinakselrod.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kevinakselrod.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kevinakselrod.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=32&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kevinakselrod.wordpress.com/2009/09/10/ensuring-repeating-fields-are-not-blank-in-infopath-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88a0f23c98fdb84783bdfceb3c93fe98?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kevinakselrod</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/rule13.jpg" medium="image">
			<media:title type="html">rule1</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/tt_isnotblank.png" medium="image">
			<media:title type="html">tt_isNotBlank</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/tt_isblank.png" medium="image">
			<media:title type="html">tt_isBlank</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/tt_not_isblank.png" medium="image">
			<media:title type="html">tt_not_isBlank</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/isblank.jpg" medium="image">
			<media:title type="html">isBlank</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/09/expression.jpg" medium="image">
			<media:title type="html">expression</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow stops responding after List item is updated programmatically</title>
		<link>http://kevinakselrod.wordpress.com/2009/06/24/workflow-stops-responding-after-list-item-is-updated-programmatically/</link>
		<comments>http://kevinakselrod.wordpress.com/2009/06/24/workflow-stops-responding-after-list-item-is-updated-programmatically/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 17:07:39 +0000</pubDate>
		<dc:creator>Kevin Akselrod</dc:creator>
				<category><![CDATA[Forms Library]]></category>
		<category><![CDATA[InfoPath]]></category>
		<category><![CDATA[InfoPath 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://kevinakselrod.wordpress.com/?p=13</guid>
		<description><![CDATA[I ran into an interesting situation today, and I could not find a solution online, so I figured I&#8217;d post this up in case someone else runs into the same issue.  I don&#8217;t guarantee that this is the best solution, so if anyone has any better ways to go about this, please comment. I am [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=13&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I ran into an interesting situation today, and I could not find a solution online, so I figured I&#8217;d post this up in case someone else runs into the same issue.  I don&#8217;t guarantee that this is the best solution, so if anyone has any better ways to go about this, please comment.</p>
<p>I am creating a workflow that needs escalation capabilities.  Because of the issues that SharePoint has with Delaying, I decided to make a separate console application that can be run as a timer job to check the running workflows on my list items and nudge them along if necessary.</p>
<p>That&#8217;s a bit of a broad, general overview.  Here are the specific details of the issue I ran into:</p>
<p>The workflow is designed to wait until the item on which it is running has a certain field updated to a value other than the default.  This is taken care of by placing an OnWorkflowItemChanged activity within a While activity:</p>
<p><a href="http://kevinakselrod.files.wordpress.com/2009/06/workflowsnippet.png"><img class="aligncenter size-full wp-image-15" title="WorkflowSnippet" src="http://kevinakselrod.files.wordpress.com/2009/06/workflowsnippet.png?w=700" alt="WorkflowSnippet"   /></a></p>
<p>If I edit the item myself, through the UI, it works without a hitch &#8211; once the correct field is edited, the workflow moves on.  The interesting part is the behavior when the list item is edited programmatically in my console application:</p>
<pre>
<pre>    workflow.ParentItem["FieldName"] = "NewValue";
    workflow.ParentItem.Update();</pre>
</pre>
<p>The field will update, but the OnWorkflowItemChanged (ItemChaanged2) event won&#8217;t fire.  In fact, after running the code above, the event won&#8217;t even fire from the UI anymore.</p>
<p>The solution?</p>
<p>Web services:</p>
<pre>
<pre>    // Create the web service reference
    Lists.Lists listsService = new Lists.Lists();

    // Set credentials
    listsService.Credentials = CredentialCache.DefaultCredentials;

    // Set the URL
    listsService.Url = string.Format(
        "{0}/_vti_bin/lists.asmx",
        siteURL
      );

    // Build the CAML statement
    string updateCAML = "&lt;Method ID='1' Cmd='Update'&gt;";
    updateCAML += "&lt;Field Name='ID'&gt;" + itemID.ToString() + "&lt;/Field&gt;"; // ID of the item (index of the item in the list)
    updateCAML += "&lt;Field Name='FieldName'&gt;NewValue&lt;/Field&gt;"; // Update information
    updateCAML += "&lt;/Method&gt;";

    // Build the XmlElement object that contains the update request
    XmlDocument document = new XmlDocument();
    XmlElement batch = document.CreateElement("Batch");
    batch.SetAttribute("OnError", "Continue");
    batch.SetAttribute("ListVersion", listVersion.ToString());
    batch.InnerXml = updateCAML;

    // Do the update
    XmlNode returnNode = listsService.UpdateListItems(listID.ToString(), batch);</pre>
</pre>
<p>Like I said, I&#8217;m not sure if this is the best approach, but the workflow responded just fine when the update was made through a web service call instead of through the object model.</p>
<p><strong>If you are trying to modify promoted fields from an InfoPath form, do not use the above method.</strong> <span id="more-13"></span> To get the above to work, you would need to allow your promoted fields to be editable through the browser &#8211; and the edits would then not be available when you load the form again.  If you are working with promoted fields, the following code will let you alter the field in the form XML itself, which will both solve the above problem and still keep within the spirit of a Forms Library:</p>
<pre>
<pre>    private void AlterField(SPListItem item, string fieldXPath, string newValue, string xmlNamespace, string xmlNamespaceUri)
        {
            SPFile file = item.File;
            XmlDocument form = new XmlDocument();
            using (StreamReader reader = new StreamReader(file.OpenBinaryStream()))
            {
                form.LoadXml(reader.ReadToEnd());
            }

            MemoryStream inStream = new MemoryStream(file.OpenBinary());
            XmlDocument myDoc = new XmlDocument();
            myDoc.PreserveWhitespace = true;
            myDoc.Load(inStream);

            XmlElement root = myDoc.DocumentElement;
            XPathNavigator navigator = form.CreateNavigator();

            XmlNamespaceManager manager = new XmlNamespaceManager(navigator.NameTable);
            manager.AddNamespace(xmlNamespace, xmlNameSpaceUri);

            XmlNode fieldToAlter = root.SelectSingleNode(
                    fieldXPath,
                    manager
                );
            fieldToAlter.InnerText = newValue;

            MemoryStream outStream = new MemoryStream();
            myDoc.Save(outStream);
            file.SaveBinary(outStream.ToArray());
        }</pre>
</pre>
<p>Thanks to <strong>Christopher Jones</strong> for this solution:  <a href="http://www.qualitysharepoint.com/2009/03/update-infopath-form-from-workflow.html" target="_blank">http://www.qualitysharepoint.com/2009/03/update-infopath-form-from-workflow.html</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kevinakselrod.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kevinakselrod.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kevinakselrod.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=13&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kevinakselrod.wordpress.com/2009/06/24/workflow-stops-responding-after-list-item-is-updated-programmatically/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88a0f23c98fdb84783bdfceb3c93fe98?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kevinakselrod</media:title>
		</media:content>

		<media:content url="http://kevinakselrod.files.wordpress.com/2009/06/workflowsnippet.png" medium="image">
			<media:title type="html">WorkflowSnippet</media:title>
		</media:content>
	</item>
		<item>
		<title>First Post!</title>
		<link>http://kevinakselrod.wordpress.com/2009/05/07/first-post/</link>
		<comments>http://kevinakselrod.wordpress.com/2009/05/07/first-post/#comments</comments>
		<pubDate>Thu, 07 May 2009 19:18:40 +0000</pubDate>
		<dc:creator>Kevin Akselrod</dc:creator>
				<category><![CDATA[Blog Setup]]></category>
		<category><![CDATA[WSS 3.0]]></category>

		<guid isPermaLink="false">http://kevinakselrod.wordpress.com/?p=3</guid>
		<description><![CDATA[So, I passed my first MCTS exam yesterday (70-541 Microsoft Windows SharePoint Services 3.0 &#8211; Application Development), and I thought this would be a good time to finally start a blog.  Expect important things to be posted here. Eventually.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=3&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So, I passed my first MCTS exam yesterday (70-541 Microsoft Windows SharePoint Services 3.0 &#8211; Application Development), and I thought this would be a good time to finally start a blog.  Expect important things to be posted here.</p>
<p>Eventually.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kevinakselrod.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kevinakselrod.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kevinakselrod.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kevinakselrod.wordpress.com&amp;blog=7661410&amp;post=3&amp;subd=kevinakselrod&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kevinakselrod.wordpress.com/2009/05/07/first-post/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88a0f23c98fdb84783bdfceb3c93fe98?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kevinakselrod</media:title>
		</media:content>
	</item>
	</channel>
</rss>
