Add repeating table data to main data source from secondary data source - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Add repeating table data to main data source from secondary data source

Last post 06-30-2009 12:20 PM by mtbikerj. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-30-2009 10:12 AM

    Add repeating table data to main data source from secondary data source

    I'm very new to programming in jscript so heres what I'm trying to do.

    I have an XML list as a secondary data source with the lines that I want to collect from users and there are several calculations that I want to do on that data (sum, percent, etc...).  I have created a repeating table in the main data source and want lines inserted and the first column of the main data source to be populated with the items from the secondary data source.

     So the basic steps that I need are.  1)  Insert lines to the repeating table for the number of lines in the secondary data source.  2)  Set the text in a node of the repeating table equal to the node in the secondary data source.  3)  don't allow the users to insert any more lines.

     Is there a way to do this using jscript or am I out of luck?

  • 06-30-2009 11:53 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Add repeating table data to main data source from secondary data source

    Hello,

    We can do it using Jscript code, first you have to get the list from secondary source and set those values to one temporary node and these nodes should get added to parent node.

    var secondaryRepeatingNodes = XDocument.GetDOM(“Seconday DOM Name”).selectNodes(“Secondary XPath of the repeating nodes”);

    var parentNode = XDocument.DOM.selectSingleNode(“Repeating Parent Node XPath”);

    var repeatingNode = XDocument.DOM.selectSingleNode(“Repeating Node XPath”);

    var tempRepeatingNode = repeatingNode.cloneNode(true);

    foreach (var secondaryRepeatingNode in secondaryRepeatingNodes)

    {

    var value = secondaryRepeatingNode.selectSingleNode(“XPath of one node in secondary XML”);

    tempRepeatingNode. selectSingleNode(“XPath of need to set value”).text = value;

    //Like this you have add more number node values

    repeatingNode.appendChild(tempRepeatingNode);

    tempRepeatingNode = repeatingNode.cloneNode(true);

    }

  • 06-30-2009 12:20 PM In reply to

    Re: Add repeating table data to main data source from secondary data source

     Thanks.  I understand your method, but I am not able to use "foreach."  It gives me a syntax error.  I may have forgotten to mention that I'm using infopath 2003 as I'm sure that makes a difference.

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