Add records to repeatingTable - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Add records to repeatingTable

Last post 05-09-2008 11:31 AM by Pontmercy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-18-2008 01:47 AM

    Add records to repeatingTable

    I've add a repeating group in the main datasouce.which I want Insert/delete rows via code only.

    Pleae could someone be kind enough to tell me how can I do?

    BTW,I use JS and IP2007.

  • 04-18-2008 02:28 AM In reply to

    • Albert
    • Top 500 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: Add records to repeatingTable

    thisXdocument.View.ExecuteAction("xCollection::Insert", xmlToEdit);
     
    To determine xmlToEdit look at the advanced tab of the properties of the repeating group. This only works for a specific view.
     
  • 04-18-2008 03:23 AM In reply to

    Re: Add records to repeatingTable

    Albert

    Thanks for your quick reply.

    I've try your method,and it works well.But I have another question here. How to set values to my rows which I just added.

    Please help.....

  • 04-18-2008 04:58 AM In reply to

    Re: Add records to repeatingTable

    I've slove the problem.

    var nodes = XDocument.DOM.selectNodes("/dfs:myFields/my:group1/my:group2");

    nodes(0).selectSingleNode("./my:ProdNum").text = 123;

    But this must make sure the textbox in the repeatingTable have defaul value.Otherwise it will receive an error message.

    Why?Or anyone got other solution,please tell me.

    Thanks!

  • 04-18-2008 06:18 AM In reply to

    • Albert
    • Top 500 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: Add records to repeatingTable

    First of all, when inserting rows like this its better to use last(), then you are sure the last inserted row is selected. Check http://www.w3schools.com/XPath/xpath_syntax.asp for syntax.

    About the default value, im not sure. I'm thinking about two things:

    1. The actual element/attribute doesn't exist in the underlying xmldocument. Make sure it does, check Extra->Default values
    2. Second: xsi-nil problem, more info here: http://www.sharepointblogs.com/dooke/archive/2007/08/14/the-xsi-nil-attribute-the-correct-way.aspx. Jscript code to remove the xsi-nil attribute: if (node.attributes.getNamedItem("xsi:nil") != null) node.attributes.removeNamedItem("xsi:nil");
    Maybe you could try and describe the error message next time, it would sure make problem solving easier ;-)
     
    Albert
  • 05-09-2008 11:10 AM In reply to

    Re: Add records to repeatingTable

    My issue is a different one, but relates to the same topic (inserting rows). In my case, I'm using VB Script and IP 2003, and what I get is: 

    Object required: 'XDocument.View'

     The sentence I've used for VB Script is

      XDocument.View.ExecuteAction "xCollection::Insert", myRepTableRow_15

     And I'm using XDocument in other places

    (e.g: XDocument.DOM.selectSingleNode("/my:myFields/my:myRepTable/my:myRepRecord[last()]/my:repField").text = var

    Any clue????

    Thanks!

  • 05-09-2008 11:31 AM In reply to

    Re: Add records to repeatingTable

    I've just found out that View doesn't exist during OnLoad

     

    Any alternative for adding rows during OnLoad??

     

    Thanks!

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