<?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: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52947.aspx</link><pubDate>Fri, 19 Mar 2010 15:38:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52947</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52947.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52947</wfw:commentRss><description>&lt;p&gt;Thanks Jimmy.&amp;nbsp; So I took your advice and added the controls to my ProjectForm form and then tried submitting in my other form.&amp;nbsp; When I tried to open the ProjectForm that was submitted I got a helpful error.&amp;nbsp; The problem was that the new fields in which I added in the ProjectForm had the first letter capitalized.&amp;nbsp; When I updated the xml in the rules in my other form I used all lowercase letters.&lt;/p&gt;
&lt;p&gt;Thanks for your help again! &lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52925.aspx</link><pubDate>Fri, 19 Mar 2010 00:34:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52925</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52925.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52925</wfw:commentRss><description>&lt;p&gt;Hello again Stacie,&lt;/p&gt;&lt;p&gt;&amp;nbsp;Could you try going to the Documents tab for the ProjectForm in DAT and opening up one of the newly submitted forms to see if the new field values are present in them?&amp;nbsp; Here I&amp;#39;m supposing you added controls to the view to show their value.&amp;nbsp; That&amp;#39;s one way of trying to find out where the disconnect is happening.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Just one note - you can update a doctype&amp;#39;s XSN - even if you&amp;#39;ve added new fields - without deleting and recreating the doctype.&amp;nbsp; You can just attach the new XSN in the General tab and click Save. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52909.aspx</link><pubDate>Thu, 18 Mar 2010 16:36:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52909</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52909.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52909</wfw:commentRss><description>&lt;p&gt;Attached is my Job Survey form.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52908.aspx</link><pubDate>Thu, 18 Mar 2010 16:34:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52908</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52908.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52908</wfw:commentRss><description>&lt;p&gt;Hey Jimmy,&lt;/p&gt;
&lt;p&gt;Sorry to bother you again but I am trying to add some additional fields to be populated in my Projects table and I can&amp;#39;t get the data to populate in the additional fields.&amp;nbsp; Here&amp;#39;s what I have done so far:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;Opened the ProjectsForm in design mode and added two new fields to my main data source; Market and Location&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Saved the form.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Went to the DBXL Admin Tool and deleted the ProjectsForm form and then readded it.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Went to the database tab and mapped my Location and Market fields in my database to the form fields. Saved my configuration&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Opened my Job Survey Infopath form and updated my data connection to the updated template.xml file.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Right-clicked on the Create Project button and updated&amp;nbsp;the&amp;nbsp;my Set XML to Submit rule&amp;nbsp;as follows:&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;
&lt;p&gt;concat(&amp;#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;?mso-infoPathSolution name=&amp;quot;urn:schemas-microsoft-com:office:infopath:ProjectsForm:-myXSD-2010-02-27T08-03-19&amp;quot; href=&amp;quot;manifest.xsf&amp;quot; solutionVersion=&amp;quot;1.0.0.3&amp;quot; productVersion=&amp;quot;12.0.0&amp;quot; PIVersion=&amp;quot;1.0.0.0&amp;quot; ?&amp;gt;&amp;lt;?mso-application progid=&amp;quot;InfoPath.Document&amp;quot; versionProgid=&amp;quot;InfoPath.Document.2&amp;quot;?&amp;gt;&amp;lt;my:myFields xmlns:xsi=&amp;quot;&lt;a href="http://www.w3.org/2001/XMLSchema-instance"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/a&gt;&amp;quot; xmlns:my=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-27T08:03:19"&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-27T08:03:19&lt;/a&gt;&amp;quot; xmlns:xd=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003%22%3E%3Cmy:name%3E%3C![CDATA[&amp;#39;"&gt;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;gt;&amp;lt;my:name&amp;gt;&amp;lt;![CDATA[&amp;#39;&lt;/a&gt;, tbox_jobnamepost, &amp;quot;]]&amp;gt;&amp;lt;/my:name&amp;gt;&amp;lt;my:status&amp;gt;3&amp;lt;/my:status&amp;gt;&amp;lt;my:branch_office&amp;gt;&amp;quot;, ddl_branchoffice, &amp;quot;&amp;lt;/my:branch_office&amp;gt;&amp;lt;my:owner&amp;gt;&amp;quot;, ddl_ownername, &amp;quot;&amp;lt;/my:owner&amp;gt;&amp;lt;my:location&amp;gt;&amp;quot;, tbox_location, &amp;quot;&amp;lt;/my:location&amp;gt;&amp;lt;my:market&amp;gt;&amp;quot;, ddl_Market, &amp;quot;&amp;lt;/my:market&amp;gt;&amp;lt;/my:myFields&amp;gt;&amp;quot;)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I tested createing a new project in my Job Survey form and it updates the record but it doesn&amp;#39;t update the additional fields I added; only the ones that you originally coded for me.I checked the messages in my eventviewer and did not see any errors. &lt;/p&gt;
&lt;p&gt;Am I missing a step? &lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52498.aspx</link><pubDate>Fri, 05 Mar 2010 00:38:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52498</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52498.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52498</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hey Stacie,&lt;/p&gt;&lt;p&gt;I&amp;#39;m glad you got it straightened out.&amp;nbsp; Happy DBXL&amp;#39;ing! :-) &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52480.aspx</link><pubDate>Thu, 04 Mar 2010 17:40:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52480</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52480.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52480</wfw:commentRss><description>&lt;p&gt;Hey Jimmy,&lt;/p&gt;
&lt;p&gt;I figured it out.&amp;nbsp; I did a search on the InfoPath Dev site and found a post that said the error happens when there is C# code specified even if there is no code within the form.&amp;nbsp; I went to Form Options | Programming and clicked the Remove Code form, saved and reposted to doctype in DBXL and it worked.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Yippeee!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks so much for all your help...you&amp;#39;re a lifesaver!&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52475.aspx</link><pubDate>Thu, 04 Mar 2010 17:13:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52475</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52475.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52475</wfw:commentRss><description>&lt;p&gt;Jimmy,&lt;/p&gt;
&lt;p&gt;I have added the ProjectForm.xsn and mapped it to my project table as instructed.&amp;nbsp; I also added my other form (Job Setup Form) as a doctype and mapped its fields.&amp;nbsp; When I try to create a new document from the Job Setup Form doctype I get the following error:&lt;/p&gt;
&lt;p&gt;InfoPath cannot open the selected form because of an error in the form&amp;#39;s code.&lt;br /&gt;One or more required components of InfoPath or the form template cannot run because of a security restriction.&lt;br /&gt;Contact your system administrator or run Setup again to confirm that .NET Programmability Support is installed on your computer.&lt;br /&gt;Request for the permission of type &amp;#39;Microsoft.Office.InfoPath.InfoPathPermission, Microsoft.Office.InfoPath.Client.Internal.Host, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;#39; failed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentsCollectionWrapper.NewFromSolution(Object varURI)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at AdminTool.Configuration.btnNewDocument_OnClick(DocActionEvent e)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Do you think this has something to do with the setup we did to create a new project?&amp;nbsp; This coding shouldn&amp;#39;t be accessing my individual computer, correct?&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52452.aspx</link><pubDate>Thu, 04 Mar 2010 14:46:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52452</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52452.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52452</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You should add the ProjectForm.xsn form as a doctype in DBXL, and map that to your project table, but you don&amp;#39;t need to add or use its template.xml file as a secondary source in your Job Setup Form (the data source called CreateProject in your form right now).&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Your rules build the XML to submit and submit them using the SubmitDocument-Projects data connection.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Does that make sense? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52379.aspx</link><pubDate>Wed, 03 Mar 2010 14:53:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52379</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52379.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52379</wfw:commentRss><description>&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;Thanks Jimmy.&amp;nbsp; So if I&amp;#39;m not using the secondary source (ProjectForms.xsn) How do I do the mapping in DBXL?&amp;nbsp; Do I use Job Setup Form twice? &lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52367.aspx</link><pubDate>Wed, 03 Mar 2010 03:12:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52367</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52367.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52367</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I&amp;#39;m also uploading a copy of your form with the changes in it.&amp;nbsp; Remember to update the concat() formula to include your project name.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52366.aspx</link><pubDate>Wed, 03 Mar 2010 03:10:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52366</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52366.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52366</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello Stacie,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;m using the concat() formula in the second action of the &lt;b&gt;Set Values&lt;/b&gt; rule on the button (see attached image).&lt;/p&gt;
&lt;p&gt;If all of the requisite values are already in your main data source, there isn&amp;#39;t even any need to create a secondary data source to hold them.&amp;nbsp; You can just set up the concat() formula to pull the field values from the main data source.&amp;nbsp; In this situation, you would hardcode the Status value of 3 into the concat() function and omit the rule that sets it in the secondary data source.&amp;nbsp; The resulting concat() formula would look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;concat(&amp;#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;?mso-infoPathSolution name=&amp;quot;urn:schemas-microsoft-com:office:infopath:ProjectsForm:-myXSD-2010-02-27T08-03-19&amp;quot; href=&amp;quot;manifest.xsf&amp;quot; solutionVersion=&amp;quot;1.0.0.3&amp;quot; productVersion=&amp;quot;12.0.0&amp;quot; PIVersion=&amp;quot;1.0.0.0&amp;quot; ?&amp;gt;&amp;lt;?mso-application progid=&amp;quot;InfoPath.Document&amp;quot; versionProgid=&amp;quot;InfoPath.Document.2&amp;quot;?&amp;gt;&amp;lt;my:myFields xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-27T08:03:19&amp;quot; xmlns:xd=&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;gt;&amp;lt;my:name&amp;gt;&amp;lt;![CDATA[&amp;#39;, &lt;span style="color:red;"&gt;&amp;quot;ADD THE FIELD FOR YOUR PROJECT NAME HERE&amp;quot;&lt;/span&gt;, &amp;quot;]]&amp;gt;&amp;lt;/my:name&amp;gt;&amp;lt;my:status&amp;gt;&lt;span style="color:red;"&gt;&lt;b&gt;3&lt;/b&gt;&lt;/span&gt;&amp;lt;/my:status&amp;gt;&amp;lt;my:branch_office&amp;gt;&amp;quot;, ../my:Job_Information/my:ddl_branchoffice, &amp;quot;&amp;lt;/my:branch_office&amp;gt;&amp;lt;my:owner&amp;gt;&amp;quot;, ../my:Job_POCs/my:ddl_ownername, &amp;quot;&amp;lt;/my:owner&amp;gt;&amp;lt;/my:myFields&amp;gt;&amp;quot;)&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t able to find a field in your form that would seem to be a place for the user to type in a master project name, so that&amp;#39;s marked in red with a placeholder in red above.&amp;nbsp; You would need to replace this (quotes and all) with whatever field you&amp;#39;re using for the project name.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52354.aspx</link><pubDate>Tue, 02 Mar 2010 20:06:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52354</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52354.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52354</wfw:commentRss><description>&lt;p&gt;Hey Jimmy,&lt;/p&gt;
&lt;p&gt;Have a couple more questions for you. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;quot;I&amp;#39;m using a rule on the button that utilizes the concat() formula to build the XML to submit using the values in the &lt;b&gt;ProjectsDom&lt;/b&gt; data source.&amp;nbsp; That full formula looks like this:&amp;quot; &lt;/p&gt;
&lt;p&gt;I looked at the rules in your button and don&amp;#39;t see where you added the concat() formula.&lt;/p&gt;
&lt;p&gt;Also, on my main form, the fields that are collecting the Name, Branch and Owner are located in the Main source, do I need to pull the fields from the secondary source?&amp;nbsp;If so, how do I handle&amp;nbsp;the fields for my Branch and Owner as they are dropdown lists that are being populated by external data?&amp;nbsp; I&amp;#39;ve attached my forms so that you can see what I mean.&amp;nbsp; In my Job Setup Form, the Job name textbox value will populate the project name,&amp;nbsp;Owner Name dropdown list value&amp;nbsp;will populate the owner and the Branch Office dropdown will populate the branch field. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks so much for your help on this!&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52317.aspx</link><pubDate>Tue, 02 Mar 2010 02:03:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52317</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52317.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52317</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Open up ProjectForm.xsn in design mode, and from the File menu select Save as source files... and choose a directory for the extracted source files.&lt;/p&gt;&lt;p&gt;Then in your main form, go to the Add Data Connection dialog, select the option to add an XML secondary data source and select the template.xml from the directory where you extracted ProjectForm.xsn&amp;#39;s source.&amp;nbsp; Use all the default options &amp;quot;Store the file as a resource, query on open&amp;quot; but give the data source a more meaningful name than just &amp;quot;template.&amp;quot; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52309.aspx</link><pubDate>Mon, 01 Mar 2010 22:51:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52309</guid><dc:creator>imstac</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52309.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52309</wfw:commentRss><description>&lt;p&gt;Thanks Jimmy.&lt;/p&gt;
&lt;p&gt;Can you explain how I do this part?&lt;/p&gt;
&lt;p&gt;&amp;quot;I added the &lt;b&gt;template.xml &lt;/b&gt;file from ProjectForm.xsn&amp;#39;s source as a secondary XML data connection in SubmitProjects.xsn.&amp;nbsp; This allows you to store the project values in a location outside the main data source before they are submitted.&amp;quot;&lt;/p&gt;</description></item><item><title>Re: Code behind for button to update to a SQL table</title><link>https://www.infopathdev.com:443/forums/thread/52269.aspx</link><pubDate>Sat, 27 Feb 2010 11:25:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52269</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52269.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52269</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Please observe the forms in the attached ZIP.&amp;nbsp; Please add both forms as new doctypes in DBXL.&amp;nbsp; Use the doctype name &lt;b&gt;ProjectForm &lt;/b&gt;for the ProjectForm.xsn file, and any name of your choosing for the other form.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The ProjectForm will have a mapping to your Projects table in the database (please add a mapping for it)&lt;/li&gt;&lt;li&gt;The other form will demonstrate how to submit forms to this doctype without submitting the main data source.&amp;nbsp; Please open this form from DBXL, fill in a few values, and click Create Project.&amp;nbsp; This should cause a form to be submitted to DBXL.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now please open the SubmitProjects.xsn form in the InfoPath designer to see how it works.&amp;nbsp; There are several things to note here:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The forms are being submitted using a &lt;b&gt;Receive&lt;/b&gt; (instead of &lt;b&gt;Submit&lt;/b&gt;) data connection to DBXL&amp;#39;s SubmitDocument web method.&amp;nbsp; It&amp;#39;s possible to use either type of data connection, but using a Receive connection offers the benefit of being able to set the arguments using rules (instead of binding them to fields), and easily accessing the result and errors returned from the webmethod.&lt;/li&gt;&lt;li&gt;When setting up the SubmitProject data connection, I specified &amp;quot;ProjectForm&amp;quot; as the doctype name so it will always have this value by default, and unchecked the &amp;quot;Query data when the for is opened&amp;quot; option.&lt;/li&gt;&lt;li&gt;I added the &lt;b&gt;template.xml &lt;/b&gt;file from ProjectForm.xsn&amp;#39;s source as a secondary XML data connection in SubmitProjects.xsn.&amp;nbsp; This allows you to store the project values in a location outside the main data source before they are submitted.&lt;/li&gt;&lt;li&gt;I&amp;#39;m using a rule on the button that utilizes the concat() formula to build the XML to submit using the values in the &lt;b&gt;ProjectsDom&lt;/b&gt; data source.&amp;nbsp; That full formula looks like this:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;concat(&amp;#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;?mso-infoPathSolution name=&amp;quot;urn:schemas-microsoft-com:office:infopath:ProjectsForm:-myXSD-2010-02-27T08-03-19&amp;quot; href=&amp;quot;manifest.xsf&amp;quot; solutionVersion=&amp;quot;1.0.0.3&amp;quot; productVersion=&amp;quot;12.0.0&amp;quot; PIVersion=&amp;quot;1.0.0.0&amp;quot; ?&amp;gt;&amp;lt;?mso-application progid=&amp;quot;InfoPath.Document&amp;quot; versionProgid=&amp;quot;InfoPath.Document.2&amp;quot;?&amp;gt;&amp;lt;my:myFields xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-27T08:03:19&amp;quot; xmlns:xd=&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;gt;&amp;lt;my:name&amp;gt;&amp;lt;![CDATA[&amp;#39;, xdXDocument:GetDOM(&amp;quot;ProjectsDom&amp;quot;)/ns1:myFields/ns1:name, &amp;quot;]]&amp;gt;&amp;lt;/my:name&amp;gt;&amp;lt;my:status&amp;gt;&amp;quot;, xdXDocument:GetDOM(&amp;quot;ProjectsDom&amp;quot;)/ns1:myFields/ns1:status, &amp;quot;&amp;lt;/my:status&amp;gt;&amp;lt;my:branch_office&amp;gt;&amp;quot;, xdXDocument:GetDOM(&amp;quot;ProjectsDom&amp;quot;)/ns1:myFields/ns1:branch_office, &amp;quot;&amp;lt;/my:branch_office&amp;gt;&amp;lt;my:owner&amp;gt;&amp;quot;, xdXDocument:GetDOM(&amp;quot;ProjectsDom&amp;quot;)/ns1:myFields/ns1:owner, &amp;quot;&amp;lt;/my:owner&amp;gt;&amp;lt;/my:myFields&amp;gt;&amp;quot;)&lt;/p&gt;&lt;p&gt;Though it may look intimidating, all I&amp;#39;ve done here is take the XML from the &lt;b&gt;template.xml&lt;/b&gt; file of ProjectForm.xsn&amp;#39;s source, removed all the line breaks, and split it up in the location where the values go.&amp;nbsp; The XML is surrounded by single quotes to represent it as string values, and this is interspersed with XPath to &lt;b&gt;ProjectsDom&lt;/b&gt;&amp;#39;s values (I added these using the &lt;b&gt;Insert Field or Group...&lt;/b&gt; feature).&amp;nbsp; Notice that I&amp;#39;ve also removed all of the xsi:nil=&amp;quot;true&amp;quot; attributes, and added &lt;b&gt;&amp;lt;![CDATA[&lt;/b&gt; and &lt;b&gt;]]&amp;gt;&lt;/b&gt; before and after the location where the &lt;i&gt;name&lt;/i&gt; value goes, to prevent any problems with XML symbols that might be present in the name.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Please give this a try, and let me know if you have any further questions. &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>