InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table - InfoPath Dev
in

InfoPath Dev

InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

Last post 11-17-2011 11:57 PM by ganee. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-16-2011 11:43 PM

    • ganee
    • Not Ranked
    • Joined on 11-16-2011
    • Posts 6

    InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

    v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0 false false false false EN-US JA X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

    Hi,

    I am new to INFOPATH. I am using INFOPATH 2003 and .NET webservice which connect's database. I binded the Repeating Table from the webservice datasource(Secondary Datasource). This table contains 3 rows. Now i want to add a new row to the repeating table but binding the repeating table not allowing me to create a new row using Xdocument.View.ExecuteAction(..). After more googling i found its possible through JScript. I've written the code like below.

    var secondDS = XDocument.GetDOM("GetProductNotes");

    secondDS.setProperty("SelectionNamespaces", 'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"'+' xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');

    var secondaryRepeatingNodes = secondDS.selectNodes("/dfs:myFields/dfs:dataFields/ProductNote");

    XDocument.UI.Alert(secondaryRepeatingNodes.length);

     This returns "0" here. What is the problem? I’ve given the XML structure in the attachment. Please help. This is urgent.


  • 11-17-2011 06:26 AM In reply to

    Re: InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

    It looks like beneath dfs:dataFields, you have GetProductsNoteResponse, GetProductsNodeResult, ProductNotes, and then ProductNote, and these all have the namespace http://thomsonlearning.ecomm.orca.com, so you need to assign a namespace prefix to that url in the selection namespaces and use that in the XPath.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-17-2011 11:08 PM In reply to

    • ganee
    • Not Ranked
    • Joined on 11-16-2011
    • Posts 6

    Re: InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

    Thanks for your response Jimmy Rishe.

    Still i'm unable to parse the xml after using the namespace in JScript. See my below code. Please let me know where i'm making mistake.

        var secondDS = XDocument.GetDOM("GetProductNotes");

        secondDS.setProperty("SelectionNamespaces", 'xmlns:dfs="http://thomsonlearning.ecomm.orca.com"'+' xmlns:d="http://thomsonlearning.ecomm.orca.com"');

        var secondaryRepeatingNodes = secondDS.selectNodes("/dfs:myFields/dfs:dataFields/ProductNotes/ProductNote");

        XDocument.UI.Alert(secondaryRepeatingNodes.length);

  • 11-17-2011 11:28 PM In reply to

    Re: InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

    The dfs namespace url was right the way it was before.  That shouldn't be changed.  And as I pointed out previously, it appears that this path is missing a whole bunch of pieces between dfs:dataFields and Product notes, and you also need to add the d: prefix before ProductNotes, ProductNote, etc.

    /dfs:myFields/dfs:dataFields/ProductNotes/ProductNote

     Can I ask what it is you're looking to do with this code, exactly?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-17-2011 11:57 PM In reply to

    • ganee
    • Not Ranked
    • Joined on 11-16-2011
    • Posts 6

    Re: InfoPath2003- Secondary Datasource binding using JScript - Add New Row to Repeating Table

      Normal 0 false false false EN-US JA X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS Mincho"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} Tools: InfoPath 2003

    Language: JScript

    I have a form that pulls data from a database through a webservice, and I have this datasource bound to a repeating table. What I would like to be able to do is to insert/edit/ or delete records in this repeating table so that when chages are done I can use another webservice to write this corrected table back to the database. When you bind a repeating table to a secondary datasource then the insert/delete is no longer available.

    I'm trying to add a Xml Node to the secondary source  and assuming that it creates a new row in the UI. Correct me if i'm wrong.

    Also please let me know how do I get around this? Our goal is to do as much as possible without the use of code, but I would be open to that as a solution if that is the only way this can be done.

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.