<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: XPath query to check if a field would be a duplicate?</title><link>https://www.infopathdev.com:443/forums/thread/42167.aspx</link><pubDate>Wed, 27 May 2009 16:59:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42167</guid><dc:creator>burtikus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42167.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42167</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Actually, this issue turned out to be related to the default view of the library in SharePoint.&amp;nbsp; Updating the default view to show all the items in the library fixed the issue.&amp;nbsp; I will experiment with basing my data source off a different view, so that the default view can still be paged, but for now my issue is resolved.&amp;nbsp; Thanks Hilary for your help! &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: XPath query to check if a field would be a duplicate?</title><link>https://www.infopathdev.com:443/forums/thread/41990.aspx</link><pubDate>Fri, 22 May 2009 20:59:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41990</guid><dc:creator>burtikus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41990.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41990</wfw:commentRss><description>&lt;p&gt;That expression gets me most of the way there.&amp;nbsp; Thanks Hilary!!&lt;/p&gt;&lt;p&gt;One question though.&amp;nbsp; This code now works for preventing duplicates against the most recent 100 forms in the library.&amp;nbsp; Further back than that though, it does not find any results to the xpath query.&amp;nbsp; I know the SharePoint user interface displays the library in pages of 100 forms - but accessing it through a query like this?&amp;nbsp; I gotta say, this puzzles me.&amp;nbsp; Is there a workaround?&lt;/p&gt;&lt;p&gt;Tim&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: XPath query to check if a field would be a duplicate?</title><link>https://www.infopathdev.com:443/forums/thread/41904.aspx</link><pubDate>Wed, 20 May 2009 22:00:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41904</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41904.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41904</wfw:commentRss><description>&lt;p&gt;I think you want:&lt;/p&gt;&lt;font face="Courier New"&gt;string sExistingTitle = xnMyForm.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/dfs:Request_For_Change/@Title[. = &amp;#39;&amp;quot; + sNewTitle + &amp;quot;&amp;#39;]&amp;quot;, NamespaceManager);&lt;/font&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>XPath query to check if a field would be a duplicate?</title><link>https://www.infopathdev.com:443/forums/thread/41895.aspx</link><pubDate>Wed, 20 May 2009 19:13:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41895</guid><dc:creator>burtikus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41895.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41895</wfw:commentRss><description>&lt;p&gt;Hi all.&amp;nbsp; I&amp;#39;m having a bit of trouble figuring out how to accomplish something.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Basically, I have an InfoPath 2007 form being submitted to a MOSS 2007 Form Library.&amp;nbsp; I originally set this up to use a Title field that&amp;#39;s on the form itself as the document title when the form is submitted.&amp;nbsp; This &amp;quot;seemed like a good idea at the time&amp;quot; (TM).&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;Now, though, I realize that if someone ever names their form the exact same thing as any other form, it will overwrite the old one, not make a new on with the same title.&amp;nbsp; This strikes me as &amp;quot;Not a Good Idea&amp;quot; and so I am trying to fix it.&lt;/p&gt;
&lt;p&gt;My thought is that I would create a second connection to the SharePoint form library to receive data, and set it to retrieve only the titles of all the documents.&amp;nbsp; Then in the updated event of my title field, check whether there is a duplicate title name and raise a validation error if that&amp;#39;s the case.&amp;nbsp; I&amp;#39;m having some difficulty in figuring out how to handle the xpath stuff to make this happen, as I really don&amp;#39;t know xml or infopath all that well.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my code:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;public void Title_Changed(object sender, XmlEventArgs e)&lt;br /&gt;{&lt;br /&gt;// Write your code here to change the main data source.&lt;br /&gt;&lt;br /&gt;XPathNavigator xnMyForm = this.CreateNavigator();&lt;br /&gt;XmlNamespaceManager ns = this.NamespaceManager;&lt;br /&gt;&lt;br /&gt;string sNewTitle = xnMyForm.SelectSingleNode(&amp;quot;/my:ChangeRequest/my:HeaderInfo/my:Title&amp;quot;, ns).Value;&lt;br /&gt;&lt;br /&gt;DataConnection TitleConnection = this.DataConnections[&amp;quot;RFC_Titles&amp;quot;];&lt;br /&gt;TitleConnection.Execute();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string sExistingTitle = xnMyForm.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/dfs:Request_For_Change[@Title = &amp;#39;&amp;quot; + sNewTitle + &amp;quot;&amp;#39;]/@Title&amp;quot;, NamespaceManager);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// if there WAS a result returned, raise an error&lt;br /&gt;--&amp;gt;Add if statement here to check this&lt;br /&gt;this.Errors.Add(TitleField, &amp;quot;TitleError&amp;quot;, &amp;quot;The RFC Titlte Must be Unique.&amp;quot;);&lt;br /&gt;&lt;br /&gt;// else, if there was not, make sure there is no error&lt;br /&gt;--&amp;gt;figure out how to do this right also&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;this.Errors.Delete(&amp;quot;TitleError&amp;quot;);&lt;br /&gt;}&lt;br /&gt;catch { }&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;Can anyone offer any suggestions?&amp;nbsp; Am I on the right track?&amp;nbsp; Is there a much much easier way to do this that I&amp;#39;m not thinking of?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;Thanks!!!&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>