Repeating Table Overwriting - InfoPath Dev
in

InfoPath Dev

Repeating Table Overwriting

Last post 06-20-2012 10:17 AM by shep123. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-20-2012 05:54 AM

    Repeating Table Overwriting

    I have a repeating table that is dependent on a set of 3 cascading listboxes. I also have an add button that takes the information from the listboxes, adds them to the repeating table, and then inserts a blank row below. The issue I run into is when I pick a new item, in this case a product, and click the add button it does everything right except it overwrites the old data with the new data. Here is an example:

    I select Staples/OfficeSupplies/Paperclips. That fills row 1 and inserts row 2. Now let's say I pick another product Staples/Printer/PrinterXXXXXX. Ideally my repeating table would be Staples/OfficeSupplies/Paperclips (row 1), Staples/Printer/PrinterXXXXXX (row 2), and blank row (row 3). Instead I get Staples/Printer/PrinterXXXXXX (row 1), Staples/Printer/PrinterXXXXXX (row 2), and blank row (row 3).

     Does anyone have any idea how to fix this? If it helps I am using InfoPath 2003 and using rules to populate the repeating table.

    Filed under:
  • 06-20-2012 08:58 AM In reply to

    Re: Repeating Table Overwriting

    Hi - if you are adding a row to the repeating table when you make a selection, you must have some code in the form, right?

    At any rate, the rule is probably on a field outside of the repeating group, and InfoPath will always set all instances of a repeating field in that case. You can manually modify the manifest file to work around this (blog post here), or since you are already using code to add the new item, perhaps just use code to update the additional item?

    Hilary Stoupa

  • 06-20-2012 09:04 AM In reply to

    Re: Repeating Table Overwriting

    Another option would be to place the rules on the repeating group itself.  These will get triggered when the row is added, and you can use these to copy the selected values into just the new row.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-20-2012 09:24 AM In reply to

    Re: Repeating Table Overwriting

    I think Jimmy's way will be easier. My only question is how exacly to do that. I just don't know how to tell it that the field's value I want to change is the blank row.

  • 06-20-2012 09:48 AM In reply to

    Re: Repeating Table Overwriting

    If code is a better option I have no idea what code to use. I found this code online and got it to work that way. Don't really know where to start (I'm limited in VBS, VBA would be different story and I know they are similar).


    Sub addProductButton_OnClick(eventObj) ' 
    XDocument.View.ExecuteAction "xCollection::insert", "group5_2"
    End Sub

  • 06-20-2012 10:08 AM In reply to

    Re: Repeating Table Overwriting

    If you place the rule on the repeating group itself, then the rule will fire on that row, and only that row, when the row is added.  Any fields you reference with Set Value actions will be the ones inside that same row.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-20-2012 10:17 AM In reply to

    Re: Repeating Table Overwriting

    Thanks Jimmy! I just figured it out. I created hidden text boxes that would hold the value of the selection when the add button was clicked. Then made the repeating table = to those values. This may be not be the best or most efficient way but it work.

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