<?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: Secondary datasource webservice from code</title><link>https://www.infopathdev.com:443/forums/thread/14985.aspx</link><pubDate>Fri, 05 Jan 2007 20:23:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14985</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14985.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14985</wfw:commentRss><description>Hi Jim,&lt;br /&gt;&lt;br /&gt;Thanks for the detailed post, but we don't really have time to read &lt;br /&gt;every line of your code.  Can you paste just the section that is giving &lt;br /&gt;you an error and also the error message that you are receiving?  I have &lt;br /&gt;a hunch that this problem is happening because of a namespace issue.</description></item><item><title>Secondary datasource webservice from code</title><link>https://www.infopathdev.com:443/forums/thread/13020.aspx</link><pubDate>Fri, 05 Jan 2007 12:22:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13020</guid><dc:creator>jweir</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13020.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13020</wfw:commentRss><description>EDITED sorry for the long post the last time. I have just put the code that is causing me the problem.. thanks again for all your help&lt;br /&gt;Thank Matt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Good Morning all...&lt;br /&gt;&lt;br /&gt;Big laugh here(laugh at myself).. one day I will understand all InfoPath... but until then thanks goodness for this web site. &lt;br /&gt;&lt;br /&gt;Here is my new problem that I am running into.. &lt;br /&gt;with the help of Matt and everyone here I am able to load data fields into other data fields on a form with out a problem. &lt;br /&gt;&lt;br /&gt;Now I have need to take a field from that table 'Email' and have that look up on "Contacts" from a SharePoint web service. What I have done so far is use a Rule to get this done.&lt;br /&gt;&lt;br /&gt;here is the Rule that I am using.. it works but all very well..&lt;br /&gt;&lt;b&gt;Rule if Email is present Action is&lt;/b&gt;&lt;i&gt; SingleName = concat(@Last_Name[@E-mail_Address = Email], " ", @First_Name[@E-mail_Address = Email]&lt;/i&gt;&lt;br /&gt;this will get great for me lastname firstname from the email cool.. &lt;br /&gt;then I do the same thing for the phone number and that works out great to.. for the first record.. &lt;br /&gt;&lt;br /&gt;the second record in the table will not have the correct information assigned to it. &lt;br /&gt;&lt;br /&gt;Here is a table of what happens&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;b&gt;Name	                  Email	                        Phone&lt;/b&gt;&lt;br /&gt;Smith Steve	james.Jone@somewhere.com	999-XXYY&lt;br /&gt;Jones James	Steve.Smith@somewhere.com	999-XXYY&lt;/i&gt;&lt;br /&gt;&lt;hr noshade size="1"&gt;&lt;br /&gt;&lt;br /&gt;what I am doing in code is appending child to contributor repeating list and then to get the field to refresh I am storing it in a temp and then putting it back to the field email on the form this process kicks off the rule that concat the lastname and firstname together and another rule puts the phone number in. I see want is happen little here. &lt;br /&gt;&lt;br /&gt;I do not have the pointer when I am doing either task. when I am adding the new record to the repeating list I am at the end of the list, which is good. But when I running the rules I am at the beginning of the list and that where the problem of name not matching email or phone number. &lt;br /&gt;&lt;br /&gt;Sorry for the long explanation here; just given background. &lt;br /&gt;&lt;br /&gt;where I am having the problem is connecting and or reading a secondary datasource from code &lt;br /&gt;&lt;br /&gt;here is the data struture &lt;br /&gt;from the Contact list on sharepoint.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;myFields &lt;i&gt;(group)&lt;/i&gt;&lt;br /&gt;dataFields &lt;i&gt;(group)&lt;/i&gt;&lt;br /&gt;Contacts&lt;i&gt;(group)(repeating)&lt;/i&gt;&lt;br /&gt;:Last_Name &lt;i&gt;(field)&lt;/i&gt;&lt;br /&gt;:First_Name &lt;i&gt;(field)&lt;/i&gt;&lt;br /&gt;:E-mail_address &lt;i&gt;(field)&lt;/i&gt;&lt;br /&gt;:Business_Phone &lt;i&gt;(field)&lt;/i&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the code that I am using &lt;br /&gt;I know if I can create a newnode and store everything in the new node and then append that child I will have a solution to this problem. where I am having problem and looking thought the how-to have helped a lot, but I am still not sure how to get the secondary datasource to work.. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function Display(ByVal data)&lt;br /&gt;	&lt;br /&gt;	XDocument.UI.Alert(data)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Sub AddtoTable(strValue)&lt;br /&gt;&lt;br /&gt;Dim iSelectedIndex&lt;br /&gt;Dim objSelectedNode&lt;br /&gt;dim objNode&lt;br /&gt;dim objNewRow&lt;br /&gt;dim objSimpleRow&lt;br /&gt;&lt;br /&gt;Dim Temp&lt;br /&gt;&lt;b&gt;dim objContactEmail &lt;br /&gt;Dim objContactEmailItem&lt;br /&gt;Set objContactEmail = XDocument.GetDOM("Contacts")'.selectSingleNodes("/myFields/dataFields/Contacts/E-mail_Address") /dfs:myFields/dfs:dataFields/dfs:Contacts/@E-mail_Address&lt;br /&gt;objContactEmail.setProperty "SelectionNamespaces","xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"""&lt;/b&gt;&lt;br /&gt;Set objNode = XDocument.DOM.selectNodes("/my:Project/my:Contributors/my:Contributor" )&lt;br /&gt;Set objSimpleRow = objNode.nextNode()&lt;br /&gt;Set objNewRow = objSimpleRow.cloneNode(true)&lt;br /&gt;&lt;br /&gt;Set objContactEmailItem = objContactEmail.selectNodes("/dfs:myFields/dfs:datafields/dfs:Contacts")&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;display(objContactEmailItem.selectSingleNode("@Last_Name").text)&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;On the preceeding line this is the error I get. I have namespace set and the the layout setup correctly I think.. &lt;br /&gt;Object Doesn't support this property or method '&lt;b&gt;objContactEmailItem.selectSignleNode'&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;objNewRow.selectSingleNode("/my:Contact/my:Email").text = strValue&lt;br /&gt;&lt;br /&gt;iSelectedIndex = XDocument.DOM.selectNodes("/my:Project/my:Contributors/my:Contributor").length 'GetSelectedPartsIndex("/my:Project/my:Contributors/my:Contributor") '/my:Name/my:SingleName")&lt;br /&gt;'Display("The recond Number is " &amp; Cstr(iSelectedIndex))&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").appendChild(objNewRow)&lt;br /&gt;if iSelectedIndex &amp;lt;= 2 then&lt;br /&gt;	XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").removeChild(XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").firstChild)&lt;br /&gt;end if 	&lt;br /&gt;'Display("The recond Number is " &amp; Cstr(iSelectedIndex) &amp; " The Record is " &amp; XDocument.DOM.selectSingleNode( "/my:Project/my:Contributors/my:Contributor[" &amp; Cstr(iSelectedIndex) &amp; "]/my:Name/my:SingleName" ).text)&lt;br /&gt;&lt;br /&gt;Temp = XDocument.DOM.selectSingleNode("/my:Project/my:Contributors/my:Contributor/my:Contact/my:Email").text&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:Project/my:Contributors/my:Contributor/my:Contact/my:Email").text = Temp&lt;br /&gt;'XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").lastChild&lt;br /&gt;end sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks you in advance for all your help, what a great web site. So very helpful&lt;br /&gt;Thanks again&lt;br /&gt;</description></item></channel></rss>