<?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: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20981.aspx</link><pubDate>Wed, 20 Jun 2007 08:09:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20981</guid><dc:creator>spudy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20981.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20981</wfw:commentRss><description>&lt;p&gt;Matt, You are right about the namespace. After my last post I decided to create a new datasource (from an infopath form) and then set this up as a secondary datasource. My code then did retrieve the correct count. I then compared the two XML files - and there was a very obvious difference. The root of my original file had a namespace, but none of the elements did.&lt;/p&gt;&lt;p&gt;I am presuming now that I will be able to search this&amp;nbsp;secondary datasource using an xpath filter and then drop results into a group as part of the main datasource to enable the use of a master detail table. But first I need to clean my datasource......&lt;/p&gt;&lt;p&gt;Many thanks for your help.......&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20971.aspx</link><pubDate>Tue, 19 Jun 2007 23:19:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20971</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20971.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20971</wfw:commentRss><description>&lt;p&gt;Hi Spudy,&lt;/p&gt;&lt;p&gt;From what you&amp;#39;re telling me, it&amp;nbsp;seems like&amp;nbsp;your XML does not have a namespace at all.&amp;nbsp; Try the XPath &amp;quot;/Util/Details&amp;quot; (without namespace prefixes).&amp;nbsp; I think that should work.&amp;nbsp; If that still doesn&amp;#39;t work, could you paste an example of the XML that your form is trying to query against?&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20969.aspx</link><pubDate>Tue, 19 Jun 2007 21:26:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20969</guid><dc:creator>spudy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20969.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20969</wfw:commentRss><description>&lt;p&gt;Matt,&lt;/p&gt;&lt;p&gt;Thanks for responding so fast. I had already seen it but I did revisit in case I missed something. My secondary datasource doesn&amp;#39;t have anything showing under the details tab. To get the string I extracted the files and opened in notepad the xml file and took the detail from there. It is probably worth mentioning at this stage that the data contained within the secondary datasource was originally imported from an excel spreadsheet into XML document.&lt;/p&gt;&lt;p&gt;Could this have caused an iffy xml document in some way that will not work with infopath? At times infopath seems rather sensitive.&amp;nbsp;I am now wondering if I should get the data in SQL database and use the XML output function to create a clean XML document.&lt;/p&gt;&lt;p&gt;Thanks again, Spudy.&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20962.aspx</link><pubDate>Tue, 19 Jun 2007 19:09:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20962</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20962.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20962</wfw:commentRss><description>&lt;p&gt;Hi Spudy&lt;/p&gt;&lt;p&gt;Look at silly me posting something you&amp;#39;ve already seen, haha!&amp;nbsp; I really think this is an XPath issue.&amp;nbsp; Are you sure that your &amp;quot;User List&amp;quot; DOM is also using the my namespace? If it is from another form, it might be using this same namespace, but with a different value.&amp;nbsp; You should check this&amp;nbsp; by double-clicking the nodes and looking at the Details tab, as demonstrated in the tutorial.&amp;nbsp; You will have to explicitly state the namespace from that tab in your query.&amp;nbsp; If the URI is different than the Main DOM, I would suggest using a different prefix than &amp;quot;my&amp;quot;, to lessen confusion.&lt;/p&gt;&lt;p&gt;If you are still having trouble, please provide some screenshots from your data source taskpane and the Details tab of Properties on the the /my:User/my:Details node.&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20954.aspx</link><pubDate>Tue, 19 Jun 2007 18:50:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20954</guid><dc:creator>spudy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20954.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20954</wfw:commentRss><description>&lt;p&gt;Matt, that is the example I have been working from. I have double checked my xpath but it all looks ok. I am presuming there is something obvious I am missing here. My form has very little to it, just the code I posted originally.&lt;/p&gt;&lt;p&gt;Any help on this one will be most appreciated.&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20342.aspx</link><pubDate>Mon, 04 Jun 2007 08:15:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20342</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20342.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20342</wfw:commentRss><description>See this blog post for a great tutorial on accomplishing this: &lt;a href="http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx"&gt;http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx&lt;/a&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20331.aspx</link><pubDate>Sat, 02 Jun 2007 09:42:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20331</guid><dc:creator>chang</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20331.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20331</wfw:commentRss><description>Double-check the XPath expression you are using to retrieve the nodes; it&amp;nbsp;might be incorrect.</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20178.aspx</link><pubDate>Fri, 25 May 2007 13:39:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20178</guid><dc:creator>spudy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20178.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20178</wfw:commentRss><description>&lt;p&gt;Chang,&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks for your response.&amp;nbsp; I did select this option. Any other ideas?&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20068.aspx</link><pubDate>Sun, 20 May 2007 09:37:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20068</guid><dc:creator>chang</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20068.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20068</wfw:commentRss><description>&lt;p&gt;When adding the secondary data source to your form, did you select to automatically retrieve data when the form is loaded? If not, you&amp;#39;ll need to query the data source before trying to use data that it might contain.&lt;/p&gt;</description></item><item><title>Accessing secondary datasource through code</title><link>https://www.infopathdev.com:443/forums/thread/20034.aspx</link><pubDate>Thu, 17 May 2007 09:46:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20034</guid><dc:creator>spudy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20034.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20034</wfw:commentRss><description>&lt;p&gt;I found a very useful post from Matt Faus - &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx"&gt;http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I have mapped the namespace for a secondary datasource into my form. There are no errors displayed. I then added some code to count the number of items in the datasource (I know the number but need to use the number for looping purposes)&lt;/p&gt;&lt;p&gt;The code I used is: &lt;/p&gt;&lt;p&gt;var oNodeList; &lt;/p&gt;&lt;p&gt;oNodeList = XDocument.GetDOM(&amp;quot;User List&amp;quot;).selectNodes(&amp;quot;/my:Users/my:Details&amp;quot; ); &lt;/p&gt;&lt;p&gt;var oIndex = oNodeList.length ; &lt;/p&gt;&lt;p&gt;XDocument.DOM.selectSingleNode(&amp;quot;//my:NumberofUsers&amp;quot;).nodeTypedValue = oIndex; &lt;/p&gt;&lt;p&gt;The number is returned as 0 which is not&amp;nbsp;what I expect. Is there something obvious missing here? Do I need to intialize the secondary&amp;nbsp;datasource somehow before the data is accessible?&lt;/p&gt;&lt;p&gt;Regards Spudy&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>