Add a row to repeating table - InfoPath Dev
in

InfoPath Dev

Add a row to repeating table

Last post 06-23-2006 05:01 PM by Matt Faus. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-08-2006 06:52 AM

    Add a row to repeating table

    I have repeating table and a button which adds a row after click. Button has a code:
    "thisXDocument.View.ExecuteAction("xCollection::insert","Row_18" );
    And this code works but when I put this table into section it doesn't work. What shut I do??
  • 05-08-2006 04:28 PM In reply to

    Re: Add a row to repeating table

    ExecuteAction is somewhat flaky. There's lots of places where it doesn't work. The best way to do this is to manually insert the XML you need into your DOM. You can usually grab the XML from the template.xml file or the sampledata.xml file.
  • 06-08-2006 02:04 PM In reply to

    • djay
    • Top 500 Contributor
    • Joined on 06-06-2006
    • Posts 35

    Re: Add a row to repeating table

    I'm trying to do the same thing as 10pitus82. I tried your suggestion of getting the XML structure from sampledata.xml, but I can't figure out how to open the file in C# code.

    The only function I can find to import a file is the XDocument.ImportFile() function.
    And the only function I can find to create a new XDocument is the CreateDOM() function, but that returns an IXMLDOMDocument type which can't be converted to an XDocument, so I can't use the ImportFile function.

    So, could you explain how to do this in a bit more detail for those of us that are a bit dense.

    Thanks,
    -Dan
  • 06-22-2006 06:00 PM In reply to

    • djay
    • Top 500 Contributor
    • Joined on 06-06-2006
    • Posts 35

    Re: Add a row to repeating table

    Found the solution.

    IXMLDOMDocument2.load takes a filename.
    So,
    SampleDOM = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    SampleDOM.load("sampledata.xml");

    works.

    -Dan
  • 06-23-2006 04:17 PM In reply to

    Re: Add a row to repeating table

    Yes. That is the correct solution.

    Don't forget you will need to set your namespaces before you can properly select nodes in the sampledata.xml file you just loaded.
  • 06-23-2006 05:01 PM In reply to

    Re: Add a row to repeating table

    Also, it is generally a good idea to use async = false and validateOnParse = false when creating a custom XML object like this. This might save you some headache later. Try this:

    SampleDOM = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    SampleDOM.async = false;
    SampleDOM.validateOnParse = false;
    SampleDOM.load("sampledata.xml");
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.