Repeating section inside repeating section stays bound to first item's data source - InfoPath Dev
in

InfoPath Dev

Repeating section inside repeating section stays bound to first item's data source

Last post 02-25-2014 05:49 PM by Hilary Stoupa. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 01-03-2014 09:46 AM

    Repeating section inside repeating section stays bound to first item's data source

    Happy New Year!

    My form has a repeating section where inside at the top of it a table holds some controls and at the bottom of it (still inside) another repeating section holds a table with some controls. It's like this because the table at the top of the section contains a dropdown of different Record IDs (lookup from a SharePoint list) and the lower section has a dropdown for different Line Items filtered from the Record ID chosen in the upper table dropdown. Users may have to choose any number of Line items for a single associated Record ID so the lower (inner) section must repeat.

    Once the Line Items for the first Record ID are chosen, the user may have to add another (outer) section where they choose another Record ID for which they identify another set of Line Items.

    This can continue for multiple Record IDs until the requirement is met.

    Here's the problem...

    During my tests, I choose a Record ID from the upper table inside the first repeating section. Then, I move down and choose from the dropdown inside the lower (inner) repeating section a Line Item filtered from the above Record ID. All goes well. I can even add a new lower (inner) repeating section and choose a different Line Item, over and over.

    However, when I add a new (outer) repeating section, the table at the top containing the Record ID dropdown appears blank, as it should, but at the bottom of the new (outer) section, all the (inner) repeating sections from the first repeating section above it appear with their values. These values are bound to the Record ID chosen in the dropdown of the first (outer) repeating section.

    In the subsequently added (outer) repeating section, if I choose a different Line Item, the values in the Line Items of the upper repeating section change. If I change a Line Item from the upper (inner) section, the Line Items in the lower repeating section change

    Any suggestions?

    Thanks for your help.

    Filed under:
  • 01-05-2014 10:59 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    BUMP
  • 01-06-2014 07:37 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Are you using rules to set these values? Or defaults? If you'd like me to take a quick look at your form, attach it under the Options tab in a reply - this sounds like a logic error of some kind but it is really hard to pinpoint just from a description. :)

    Hilary Stoupa

  • 01-06-2014 01:56 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Hi Hilary,

    Thanks for your reply.

    The form exists on a private intranet. We're forbidden from taking it out. I don't have a SharePoint site to connect the form to but I can show you a remake of the form here.

    If we can work on it to get it right with the attached xml file, I can adapt it to sharepoint.

     

    Thanks, Rob

     

  • 01-06-2014 02:12 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    A sample is fine - this form won't preview tho. Can you put together a sample that I can preview that will show the issue?

    Hilary Stoupa

  • 01-07-2014 05:54 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

     Hi,

    Sorry for the delay. I had to recreate the form. It is zipped together with an excel data file. This is probably going to need some explanation.

    Here's how it's supposed to work...

    First, think about the Excel file as a list in SharePoint.

    The drpdnRecordID control on the form uses the [Record ID] column; the drpdnLineItem control on the form uses values in the [Line Item] column filtered on the chosen Record ID; the read-only txt[year] fields on the form (2015, 2016, 2017, 2018, 2019, 2020) use the corresponding year columns.

    When the user chooses a Record ID from drpdnRecordID, the drpdnLineItem should only list those line item values corresponding to the chosen Record ID. When the Line Item is chosen, the year values should populate the read-only year controls. Separately, not connected with the fields, the user must manually add proposed change values beneath each year value.

    If the user needs to add a new Line Item, they add a new (inner) repeating section, choose a different line item which should populate the year controls with values corresponding to the chosen line item and then add their proposed changes. And, so on....

    If the user needs to add a new record id, they add a new (outer) repeating section and repeat the process.

    Is there a better way to do this than uses nested repeating sections?

    Thanks in advance for your help,

    ~Rob

  • 01-07-2014 03:12 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Okay, so the sample doesn't really help because it doesn't have whatever logic you have in your actual form that is failing. Looking back at your original post, you say:

    all the (inner) repeating sections from the first repeating section above it appear with their values. These values are bound to the Record ID chosen in the dropdown of the first (outer) repeating section.

    In those inner repeating sections, are you using default values? Or are you setting the values with rules? I think what you are missing in your actual form is the use of current() to get the Record ID for the current outer section.

    Hilary Stoupa

  • 01-07-2014 04:59 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Hillary, You're right. It's not much help without the logic. I'll try to build the form on a connected machine and post it tomorrow. Thanks for your patience. Rob
  • 01-08-2014 06:42 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Hilary,

    I found a machine with both InfoPath and connection to the net and rewrote the form and an accompanying xml file. They are attached.

    The form is working up to the point where I add a new outer repeating section. When one is added, it loads without any values appearing in the fields, as it should, but when a RecordID and LineItem are chosen, the values for the first repeating section's RecordID/LineItem display.

    What am I missing?

    Rob

  • 01-08-2014 07:39 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Hooray! Now I can see the issue - you are missing a filter in your defaults - you need to match on line item and record ID. The XPath looks like:

    xdXDocument:GetDOM("example")/dataset/table/fy15[../LineItem = current()/../my:drpdnLineItem and ../RecordID = current()/../../../my:drpdnRecordID]

    If you add the additional filter, you'll then get the correct data for that line item and record id - make sense?

    Hilary Stoupa

  • 01-08-2014 08:46 AM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Hilary,

    You're the best!!!

    I'm implementing now. :)

    ~Rob

  • 02-25-2014 05:23 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

     Hilary,

     I'm posting to this message because the problem I'm having is very, very similar and it's on the same form.

    For the business purpose, I have a layout table inside a repeating section inside a repeating section. In the first repeating section, I choose a RecordID from a dropdown and related data gets populated into other fields within the layout table of the first repeating section. I then add a new repeating section. The dropdown is blank awaiting a choice but all the other fields in the layout table of the new repeating section show data related to the RecordID chosen in the first repeating section. This kinda makes sense since they have been told to show values filtered for the RecordID chosen in the dropdown, but it's not what I wanted. I wanted all the fields in the repeated section to be blank.

     Any thoughts?

  • 02-25-2014 05:49 PM In reply to

    Re: Repeating section inside repeating section stays bound to first item's data source

    Are you using default values to populate the fields? Or rules? Can you add a screenshot?

    Hilary Stoupa

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