Programmatically triggering Repeating table insert - InfoPath Dev
in

InfoPath Dev

Programmatically triggering Repeating table insert

Last post 07-01-2005 07:00 AM by ScottAtRVC. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-30-2005 08:58 AM

    Programmatically triggering Repeating table insert

    Hi All.

    I currently have a repeating table which only allows the user to delete a row by the button control within the row NOT the built in InfoPath repeating table functionality.

    New rows are created programmatically by cloning the first row in the repeating table.

    However, I have now realised this is not the best solution because should the users delete all the rows, the programmatic inserting of a new row fails because there is no row to clone.

    Now using the build in InfoPath tools, a user can delete all the rows. Then press the insert new tab / button and a new row is created.

    So my question is how can I programmatically mimic the insert new row InfoPath functionality?

    Cheers. Scott.
  • 06-30-2005 12:55 PM In reply to

    Re: Programmatically triggering Repeating table insert

    Look up the ExecuteAction() method in the help file. This is what you want to use. You will need to pay special attention to the portions about SelectNodes or SelectText. These are important.

    If you can't locate your help files, take a look here:
    http://www.infopathdev.com/downloads/free/default.aspx?s=Help%20Files

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-01-2005 01:12 AM In reply to

    Re: Programmatically triggering Repeating table insert

    Hi Greg.

    Thanks so much. thisXDocument.View.ExecuteAction("xCollection::insert", "group4_6");
    Did the trick.

    Cheers. Scott.
  • 07-01-2005 07:00 AM In reply to

    Re: Programmatically triggering Repeating table insert

    Hi Greg.

    I seem to have hit a problem actually.

    The code thisXDocument.View.ExecuteAction("xCollection::insert", "group4_6"); did the trick on the form.
    With all this working, I moved the layout of the form about, which includes sections.
    And from now on the ExecuteAction method is failing with the error;
    The specified bstrAction value for the View.ExecuteAction call is not applicable for the current selection.

    I see from MSDN;
    the ExecuteAction method of the View object is used to insert data using the xCollection editing component, based on the selected context

    Am i correct that selected context means, what node is currently selected on the form?
    Because what confuses me about this is ... what if i have no nodes in my repeating table. How can i select this to perform the ExecuteAction?

    I think to summarise i am asking if you could explain the limitations to using ExecuteAction? By this i mean, say ExecuteAction for inserting a new record in a repeating table is being triggered from the OnAfterChanged event of a text box. Can the text box be located anywhere within the form Data Source / can the text box event just call ExecuteAction / what if the repeating table has no rows?

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