<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/93576.aspx</link><pubDate>Wed, 09 Oct 2013 17:41:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:93576</guid><dc:creator>NicolasA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/93576.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=93576</wfw:commentRss><description>Hello Jimmy:
  I am trying to save the infopath form data to a sql database via WCF webservice and hoping to save a copy to the sharepoint document library as well . I have already created a wcf web service , I tried to implement your method but nothing seems to be happening. I am new to infopath and I am trying to achieve both objectives. All this has to be done in code behind and I have thus far only implemeted your method, and not the saving to a sharepoint doc lib method yet. Please see the code I have written:

   using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System.Web;
using System.Windows.Forms;

namespace ProjectConceptQAReport
{
    public partial class FormCode
    {
        // Member variables are not supported in browser-enabled forms.
        // Instead, write and read these values from the FormState
        // dictionary using code such as the following:




        public void InternalStartup()
        {
            ((ButtonEvent)EventManager.ControlEvents[&amp;quot;CTRL3_5&amp;quot;]).Clicked += new ClickedEventHandler(CTRL3_5_Clicked);
            EventManager.FormEvents.Submit += new SubmitEventHandler(FormEvents_Submit);
            ((ButtonEvent)EventManager.ControlEvents[&amp;quot;CTRL4_5&amp;quot;]).Clicked += new ClickedEventHandler(CTRL4_5_Clicked);
            ((ButtonEvent)EventManager.ControlEvents[&amp;quot;bttn_Submit&amp;quot;]).Clicked += new ClickedEventHandler(bttn_Submit_Clicked);
        }

        public void CTRL3_5_Clicked(object sender, ClickedEventArgs e)
        {
            // Write your code here.
        }

        public void FormEvents_Submit(object sender, SubmitEventArgs e)
        {
            // If the submit operation is successful, set
            // e.CancelableArgs.Cancel = false;
            // Write your code here.
        }

        public void CTRL4_5_Clicked(object sender, ClickedEventArgs e)
        {
            // Write your code here.
        }



        //public void bttn_Submit_Clicked(object sender, ClickedEventArgs e)
        //{
        //    SaveData();
        //}

        //public void FormEvents_Submit(object sender, SubmitEventArgs e)
        //{
        //    SaveData();
        //}

        //public void SaveData()
        //{
        //    try
        //    {

        //        //save file to the location and file name as in xml 
        //        XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();
        //        string saveLocation = xnDoc.SelectSingleNode(&amp;quot;/my:ProjectConceptQAReport/my:SaveLocation&amp;quot;, NamespaceManager).Value;
        //        //File Name
        //        xnDoc.SelectSingleNode(&amp;quot;/my:ProjectConceptQAReport/my:FormName&amp;quot;, NamespaceManager).SetValue(xnDoc.SelectSingleNode(&amp;quot;/my:ProjectConceptQAReport/my:txt_ProjId&amp;quot;, NamespaceManager).Value + &amp;quot;Project Concept QA Report&amp;quot; + xnDoc.SelectSingleNode(&amp;quot;/my:ProjectConceptQAReport/my:CurrentDate&amp;quot;, NamespaceManager).Value);
        //        string fileName = xnDoc.SelectSingleNode(&amp;quot;/my:ProjectConceptQAReport/my:FormName&amp;quot;, NamespaceManager).Value;
        //        SaveFormToSPList(MainDataSource.CreateNavigator().OuterXml, fileName, saveLocation, true);
        //    }
        //    catch (Exception ex)
        //    {
        //        SetSystemError(&amp;quot;Error in &amp;#39;SaveData:&amp;#39; &amp;quot; + ex.Message + &amp;quot; --- &amp;quot; + ex.InnerException);
        //    }
        //}





        public void bttn_Submit_Clicked(object sender, ClickedEventArgs e)
        {
           //add your code here
            XPathNavigator mainDataNavigator = MainDataSource.CreateNavigator();

            // Generate a name for the form to be saved in SharePoint
            //string Infopath_Form_Library = Guid.NewGuid().ToString();

            // Set the name of the form on the data connection
            //root.SelectSingleNode(
            //  &amp;quot;//my:ProjectConceptQAReport&amp;quot;, NamespaceManager).SetValue(ProjectConceptQAReport);

            // Get objects for the two value nodes hooked up to the data connection
            //XPathNavigator submitValue1 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:Value1&amp;quot;, NamespaceManager);
            //XPathNavigator submitValue2 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:Value2&amp;quot;, NamespaceManager);

            XPathNavigator submitValue1 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:txt_ProjId&amp;quot;, NamespaceManager);
            XPathNavigator submitValue2 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:txt_ProjTitle&amp;quot;, NamespaceManager);
            XPathNavigator submitValue3 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:txt_ProjDate&amp;quot;, NamespaceManager);
            XPathNavigator submitValue4 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Quality&amp;quot;, NamespaceManager);
            XPathNavigator submitValue5 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Decision&amp;quot;, NamespaceManager);
            XPathNavigator submitValue6 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Strategic&amp;quot;, NamespaceManager);
            XPathNavigator submitValue7 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Relevant&amp;quot;, NamespaceManager);
            XPathNavigator submitValue8 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Monitoring&amp;quot;, NamespaceManager);
            XPathNavigator submitValue9 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Efficient&amp;quot;, NamespaceManager);
            XPathNavigator submitValue10 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Effective&amp;quot;, NamespaceManager);
            XPathNavigator submitValue11 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:ddl_Sustainability&amp;quot;, NamespaceManager);
            XPathNavigator submitValue12 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:txt_qaSummary&amp;quot;, NamespaceManager);
            XPathNavigator submitValue13 = mainDataNavigator.SelectSingleNode(&amp;quot;my:myFields/my:Doc_Status&amp;quot;, NamespaceManager);



            // Loop through each node of the repeating group
            foreach (XPathNavigator values in mainDataNavigator.Select(&amp;quot;my:myFields/my:values&amp;quot;, NamespaceManager))
            {
                // copy the values from this group&amp;#39;s nodes to the submit fields
                submitValue1.SetValue(values.SelectSingleNode(&amp;quot;my:txt_Notes&amp;quot;, NamespaceManager).Value);
                submitValue2.SetValue(values.SelectSingleNode(&amp;quot;my:txt_Date&amp;quot;, NamespaceManager).Value);
                submitValue3.SetValue(values.SelectSingleNode(&amp;quot;my:ProjManager/pc:Person/pc:DisplayName&amp;quot;, NamespaceManager).Value);
                submitValue4.SetValue(values.SelectSingleNode(&amp;quot;my:ProjManager/pc:Person/pc:AccountId&amp;quot;, NamespaceManager).Value);
                submitValue5.SetValue(values.SelectSingleNode(&amp;quot;my:ProjManager/pc:Person/pc:AccountType&amp;quot;, NamespaceManager).Value);

                // Invoke the data connection
                DataConnections[&amp;quot;WebServiceSubmitQA&amp;quot;].Execute();
            }

        }
    }
}</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/42997.aspx</link><pubDate>Tue, 16 Jun 2009 08:55:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42997</guid><dc:creator>mgovind</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42997.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=42997</wfw:commentRss><description>&lt;p&gt;HI Guys,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;This is govind, new&amp;nbsp;to InfopathDev. I read this forum i created an infopath form for submitting multiple rows at a time. Actually i am getting an error &amp;quot;&lt;strong&gt;InfoPath cannot submit the form&lt;/strong&gt;. An error occurred while the &lt;strong&gt;form&lt;/strong&gt; was being submitted&amp;quot;. But the records are submitted to the database using the webservice.. I need your help to fix this error.. Can anyone send me some idea to this..&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38928.aspx</link><pubDate>Wed, 25 Feb 2009 16:17:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38928</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38928.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38928</wfw:commentRss><description>&lt;p&gt;Great to hear that.&amp;nbsp; I wish you the best of luck with your form.&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38925.aspx</link><pubDate>Wed, 25 Feb 2009 16:10:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38925</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38925.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38925</wfw:commentRss><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;Its done. I am able to add fields and store values as you suggested.&amp;nbsp;I can not thank you enough for your help :)&lt;/p&gt;
&lt;p&gt;Thank you so much,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38917.aspx</link><pubDate>Wed, 25 Feb 2009 15:31:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38917</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38917.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38917</wfw:commentRss><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;DataConnection is hooked up to the fields EmployeeName, ProductName fields in dataFields group. And when this form is designed on database. EmployeeName and ProductName fields are populated from SQL Server database. I tried adding fields to store values as you suggested, but when i right click in datasource pane, i can not add fields to it.&lt;/p&gt;
&lt;p&gt;I also tried&lt;/p&gt;
&lt;p&gt;XPathNavigator root = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator iter = root.Select(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (iter.MoveNext())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task/d:Employee/@EmployeeName&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string EmpName = node.Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator productNode = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task/d:Product/@ProductName&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string Product = productNode.Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataConnections[&amp;quot;Data_Submit&amp;quot;].Execute();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;My main problem is how to make it go to the next repeating section. Its just stuck with first section. There should be a way to iterate through all repeating section and read values from it.&lt;/p&gt;
&lt;p&gt;Thanks a lot again for your valuable time :)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38914.aspx</link><pubDate>Wed, 25 Feb 2009 14:57:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38914</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38914.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38914</wfw:commentRss><description>&lt;p&gt;Ok, there are a few problems here.&lt;/p&gt;
&lt;p&gt;The main problem is that in each interation of the loop, you need to store the relevant values in &lt;em&gt;fields&lt;/em&gt; in the form to which the data connection is hooked up (in the data connection&amp;#39;s settings).&amp;nbsp; Right now, you&amp;#39;re just temporarily storing the references to the nodes in variables that never get used.&amp;nbsp; You should be able to use my code with very few modifications.&amp;nbsp; Here it is a little more closely tailored to your data source:&lt;/p&gt;
&lt;blockquote&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; mainDataNavigator = MainDataSource.CreateNavigator();&lt;br /&gt;&lt;br /&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Get objects for the two value nodes hooked up to the data connection&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; employeeNode= mainDataNavigator.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&lt;em&gt;create a field to hold the employee name value for the submit data connection&amp;nbsp;and put its XPath here&lt;/em&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;br /&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; productNode = mainDataNavigator.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&lt;em&gt;create a field to hold the product name and put its XPath here&lt;/em&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Loop through each node of the repeating group&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;foreach&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; values &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; mainDataNavigator.Select(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager))&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // copy the values from this group&amp;#39;s nodes to the submit fields&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;employeeNode.SetValue(values.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;d:Employee/@EmployeeName&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value);&lt;br /&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;productNode.SetValue(values.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;d:Product/@ProductName&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value);&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000" size="2"&gt;// Invoke the data connection&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;DataConnections[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Data_Submit&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;].Execute();&lt;br /&gt;}&lt;/blockquote&gt;&lt;/font&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38910.aspx</link><pubDate>Wed, 25 Feb 2009 14:36:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38910</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38910.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38910</wfw:commentRss><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;Thanks a lot for replying. I am just trying to create a Proof of Concept for Timecard app for my team and its pretty small. If this needed to be used across multiple teams, i will definitely discuss using Qdabra webservice.&lt;/p&gt;
&lt;p&gt;This is the code i wrote. My Data connection Name is &amp;quot;Data_Submit&amp;quot;. The webservice associated to this connection expects 2 parameters. So first i count the total number of repeated section and then run a for loop.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;XPathNavigator root = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator iter = root.Select(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int myCount = iter.Count;&amp;nbsp; // to count number of repeated sections at&amp;nbsp;run time&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i = 1; i &amp;lt;= myCount; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task[&amp;quot;+ i.ToString()+&amp;quot;]/d:Employee/@EmployeeName&amp;quot;, NamespaceManager);&lt;/p&gt;
&lt;p&gt;string EmpName = node.Value;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator productNode = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:EE_Prod_Cat_Task[&amp;quot; + i.ToString() + &amp;quot;]/d:Product/@ProductName&amp;quot;, NamespaceManager);&lt;/p&gt;
&lt;p&gt;string Product = productNode.Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DataConnections[&amp;quot;Data_Submit&amp;quot;].Execute();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks a lot again :)&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38886.aspx</link><pubDate>Wed, 25 Feb 2009 02:56:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38886</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38886.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38886</wfw:commentRss><description>&lt;p&gt;Are you copying the values from the repeating section to non-repeating nodes before submitting, or is the Submit connection hooked up directly to the repeating table? If you would paste your code here I could probably show you what&amp;#39;s going wrong.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Just as a side note, while this type of solution may work for a small project, if you plan to do a lot of this type of work you may want to consider using a more generalized piece of software to take care of this. Qdabra (the company that runs this site) has a web service called &lt;a class="" href="http://www.qdabra.com/en/products/DBXL.aspx"&gt;DBXL&lt;/a&gt;&amp;nbsp;that handles submitting data from InfoPath forms to a database and a whole bunch of other features as well.&amp;nbsp; I recommend checking out the free trial version.&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38874.aspx</link><pubDate>Wed, 25 Feb 2009 01:25:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38874</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38874.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38874</wfw:commentRss><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thank you so much. I am able to finish 95% of my stuff. &lt;/p&gt;
&lt;p&gt;The only remaining thing is that data from first row is getting inserted into database. So if i add three rows to the repeating table and hit submit button, then values from first row get inserted 3 times into database. I debug my code while looping through each row and check that i am able to read value from each row. But DataConnection[&amp;quot;Web Service Submit&amp;quot;].Execute() inserts data from first row only. How this can be resolved?&lt;/p&gt;
&lt;p&gt;I could not find anything to dispose DataConnections.&lt;/p&gt;
&lt;p&gt;Thanks a lot again.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38826.aspx</link><pubDate>Tue, 24 Feb 2009 04:55:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38826</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38826.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38826</wfw:commentRss><description>&lt;p&gt;It&amp;#39;s probably simpler to just go with the original idea you had and skip the arrays, though I do suggest you do some searching around to learn more about web services.&lt;/p&gt;
&lt;p&gt;I have a web service that takes two strings as parameters.&amp;nbsp; These are hooked up in the submit data connection to the my:value1 and my:value2 nodes in my form.&amp;nbsp; My form&amp;#39;s data source looks like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;myFields&lt;/div&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;my:values (repeating group)&lt;/div&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;my:val1&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;my:val2&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;li&gt;
&lt;div&gt;my:value1&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;my:value2&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
&lt;p&gt;The code below goes through each node in the &lt;em&gt;values&lt;/em&gt; group, copies its respective&amp;nbsp;values to my:value1 and my:value2, and invokes the submit.&amp;nbsp; The following code is C# code for InfoPath 2007:&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;
&lt;blockquote&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; mainDataNavigator = MainDataSource.CreateNavigator();&lt;br /&gt;&lt;br /&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Get objects for the two value nodes hooked up to the data connection&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; submitValue1 = mainDataNavigator.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:myFields/my:Value1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;br /&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; submitValue2 = mainDataNavigator.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:myFields/my:Value2&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Loop through each node of the repeating group&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;foreach&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; values &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; mainDataNavigator.Select(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:myFields/my:values&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager))&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // copy the values from this group&amp;#39;s nodes to the submit fields&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;submitValue1.SetValue(values.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:val1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value);&lt;br /&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;submitValue2.SetValue(values.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:val2&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value);&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000" size="2"&gt;// Invoke the data connection&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;DataConnections[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Web Service Submit&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;].Execute();&lt;br /&gt;}&lt;/blockquote&gt;&lt;/font&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38798.aspx</link><pubDate>Mon, 23 Feb 2009 16:04:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38798</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38798.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38798</wfw:commentRss><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;Thanks a lot for replying. I have created my own webservice.&amp;nbsp;It creates a connection to SQL Server database and then insert row into a table. I have created this webservice by looking at examples on InfopathDev and googling. And i could not find example where a webservice can accept array.&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;have written this webservice in C# .NET using Visual studio 2005. This webservice accept EmpName and DeptName&amp;nbsp;from Infopath form. Using Empname it queries database to get EmpID. Then it inserts EmpID and DeptName into another table in database.&lt;/p&gt;
&lt;p&gt;So if you can point me to&amp;nbsp;few examples of webservices which can accept an array that would be helpful.&amp;nbsp;Or if you can&amp;nbsp;help me how to loop through a repating table and call a webservice&amp;nbsp;on a button click that would be great.&lt;/p&gt;
&lt;p&gt;Thanks a lot again :)&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38796.aspx</link><pubDate>Mon, 23 Feb 2009 15:49:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38796</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38796.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38796</wfw:commentRss><description>&lt;p&gt;What kind of webservice are you using?&amp;nbsp; Is it one you made or one you obtained from somewhere?&amp;nbsp; What are the input datatypes for the web method you are calling?&amp;nbsp; If it accepts a repeating (array/list) type, you can probably submit everything with just rules.&amp;nbsp; Otherwise, code may be the way to go.&amp;nbsp; If that&amp;#39;s the case, please tell us what kind of code you are using/looking to use.&lt;/p&gt;</description></item><item><title>Re: Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38789.aspx</link><pubDate>Mon, 23 Feb 2009 15:15:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38789</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38789.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38789</wfw:commentRss><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;I am still trying to figure it out. Please help.&lt;/p&gt;
&lt;p&gt;Thanks a lot in advance,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Calling a WebService in form code when button is clicked</title><link>https://www.infopathdev.com:443/forums/thread/38732.aspx</link><pubDate>Fri, 20 Feb 2009 21:45:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38732</guid><dc:creator>Ychhoker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38732.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=38732</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have designed an infopath form which has repeating table and&amp;nbsp;a button &amp;quot;Insert Data&amp;quot; button. Insert Data button has a rule&amp;nbsp;&amp;quot;Submit using &amp;nbsp;a data connection&amp;quot; which used a Webservice to insert data into SQL Server. But this works for first row in repeating table. If there are multiple rows in repeating table, data get inserted for first row only. Is there a way to add some rule so that data from all rows get inserted into DB. If yes, please help me&lt;/p&gt;
&lt;p&gt;If not,there must be a way to do call Webservice when button is clicked. I am using Infopath 2007, SQL Server 2005 and Visual Studio 2005. Can somebody help me how to traverse/read each field in a row&amp;nbsp;through the repeating table and then call webservice to&amp;nbsp;post data to SQL Server.&lt;/p&gt;
&lt;p&gt;Thanks a lot in advance :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>