Populate Repeating Table based on Multiple Selection List box - InfoPath Dev Sign in | Join | Help in Newbie Questions InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Newbie Questions » Populate Repeating Table based on Multiple Selection List box Use our Google Custom Search for best site search results. Populate Repeating Table based on Multiple Selection List box Last post 02-27-2024 11:19 AM by Hilary Stoupa. 12 replies. Page 1 of 1 (13 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 10-07-2016 02:38 PM Winnie Joined on 09-29-2016 Posts 12 Populate Repeating Table based on Multiple Selection List box RepeatingTable.xsn Reply Contact Hi,I have a form with a multiple selection list box based on a secondary data source.A user may check one or more items in that list box. I want to build a repeating table that populates the rows based on what is checked, and within each row, the user may specify other things about the row. I attached an example to demonstrate what I am looking for.For example, if I select Apple, only the Apple row is populated, and the user can further select a radio button.If I select Apple and Lemon, those respective 2 rows are populated. Problem is that when I select the radio button, it automatically makes all the radio buttons the same selection.(I can't have one large one small) I am new to InfoPath and I'm not sure it's because I'm doing something wrong or InfoPath doesn't handle this kind of functionality.What are my other options? I'm open to recommendations.Thanks! Filed under: infopath, infopath 2010, repeating controls 10-07-2016 02:58 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box RepeatingTable.xsn Mark as Not AnswerMark as Answer... Reply Contact Do you see how the option button control has a little warning that it can't repeat where you have it? The reason is the data structure in your form isn't correct. However, if we just add attributes to the repeating field that is bound to your multi-select, the attribute nodes aren't included when the new instance of the field is inserted when the multi-select is clicked.This doesn't really surprise me - I've found multi-selects to be awfully flakey.I'm attaching a sample that does what you want - save the file locally, right click and select design to look at it in design mode, then you can preview to try it. If you look under the data tab in the ribbon, you'll see I have added 3 instances of the repeating group by default, and set a value for field1 for each - and I mention this because while this technique (mimicking a multi-select) works ok when you know in advance what the options should be, it is more difficult if you were wanting to get your options from a SharePoint List or another external data source. Hilary Stoupa 10-11-2016 07:07 AM In reply to Winnie Joined on 09-29-2016 Posts 12 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Thank you so much, Hilary!I've looked at your sample attachment and have a few more questions if you don't mind.- When you said "add attributes to the repeating field that is bound to your multi-select", what do you mean by attributes?- While I like your solution of using a repeating table with separate controls to "mimic" a multi-select, my problem is just as you described. My multi-select is actually based on an external data source and the result changes depending on other sets of cascading drop downs that users are supposed to select prior to this.I have a large list set up in SharePoint. Let's say the list contains 3 columns: Type, SubType, Segment. The multi-select is on the Segment, which changes depending on what Type and SubType the user selects first (these two are cascading drop downs). Hence my initial decision to use the multi-select control.It would be really appreciated if you can show me how to set up default value using external data source. 10-12-2016 07:04 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Hi, Winnie: - Multi-select controls are bound to a repeating field. We can't add fields to a field - only attributes. So, if you right click your repeating field in your main data source, and select add, you can add an attribute. But multi-selects are interesting in that when you make a selection, InfoPath inserts an instance of the repeating field for you, set to the value of your selection. It won't include the attributes (personally, I think this is a bug). So - even if you add attributes to the field that you can use to bind other controls, you end up with no instance of the attributes, which leaves the controls disabled. Experiment with this, and you will see what I mean. :)- To use default data for this approach (make believe multi-select, like my sample) we need to have general idea of the maximum number of options that might be available. So - do you have an idea of the max number of segment options there might be for a given type & subtype? Is this something that would change often (i.e. - is this a list that has a lot of additions or deletions or changes happening?) Hilary Stoupa 10-12-2016 03:09 PM In reply to Winnie Joined on 09-29-2016 Posts 12 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, - I see what you mean now! I understand that when you insert a new item in a repeating table, it would repeat the attribute as well, but for some reason it doesn't do that for multi-selects and it leaves the controls greyed-out. I agree that it feels like an InfoPath bug, but I guess that's just how Microsoft built it. :(- Is 50 too large of a number? To be honest I don't know what the maximum # of segment there would be for each combination of Type&Subtype. This form is meant to be expandable such that people can add/remove as many entries as they'd like in the SharePoint list and the multi-select would display accordingly. Thanks again for all your help!Winniefred 10-12-2016 04:11 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box RepeatingTableEXT.xsn Mark as Not AnswerMark as Answer... Reply Contact I'm glad you had a chance to try it, that makes it easier to understand. 50 isn't necessarily too large, it somewhat depends on the complexity of your schema. Basically, you'll have to add as many instances of the repeating group as you think you'll need in the default data settings for the form. Then, the resulting XML will have blank nodes (which you'll be hiding via formatting) - it will make your files slightly larger than they really need to be. I'm attaching another sample. In this one, I added a data connection to an XML file that is a resource in the form, so you can see the basic approach I would take. If you are comfortable working with form source files, save your template as source files and you can add all your default nodes in template.xml instead of using the ribbon controls in the designer (I'd so much rather copy / paste XML). The trickiest formula is on the "set" attribute in the repeating group - select Edit XPath on that, and let me know if you have any questions. Hilary Stoupa 10-13-2016 11:40 AM In reply to Winnie Joined on 09-29-2016 Posts 12 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Thank you so much, Hilary! Your example does exactly what I am looking to do!So my understanding is the solution would be to repeat "group4" in your example for 50 times and set the "selected" attribute's default value to "false" for each. What I am not clear on is the "set" attribute. Is this the formula to populate all the Segments based on the filtered results from selecting Type&Subtype? Why does it need to "divide by Segment" at the end of the formula?Also, do I need to set a default value for the "set" attribute for all 50 instances? Or just the first instance? I agree it'll be much nicer to copy/paste in the XML itself, but I'm not sure how to work with source files. Thanks again! 01-10-2018 05:41 AM In reply to Chris Freeman Joined on 01-08-2018 Posts 4 Re: Populate Repeating Table based on Multiple Selection List box Form1-fa-Tile.xsn Mark as Not AnswerMark as Answer... Reply Contact Hello Hilary, I'm hoping you can help me with a similar problem. I posted this in the Newbie section, but though I contact you directly. I am currently working on creating a form which has a several multi-selection boxes which I'm trying to get bound to a single repeating table. I issue is I can't figure out how to have them feed into this table. I need to get multi-selection boxes in the Quality, Process and General sections of the attached form to feed into the repeating table below it populating the Characteristic box and basically building the requirements list. Does anyone have any adviceon accomplishing this?? Thanks!! 01-10-2018 08:21 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Replied to your post here: http://www.infopathdev.com/forums/p/38798/118052.aspx#118052 Hilary Stoupa 02-22-2024 11:06 PM In reply to ncodename.sabir Joined on 04-11-2019 Posts 9 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Hi, Will this be compatible with a SharePoint repeating list? 02-23-2024 07:49 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Hi - I'm sorry, I am having trouble understanding your question. What are you trying to achieve? Hilary Stoupa 02-27-2024 12:11 AM In reply to ncodename.sabir Joined on 04-11-2019 Posts 9 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, Sorry for incomplete question. I'm attempting to create a repeating list form in SharePoint (not a library form). I want to add a secondary source that allows for the selection of multiple items, and based on those selections, I aim to create new rows. I hope I've communicated my objective clearly to you. 02-27-2024 11:19 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,268 Re: Populate Repeating Table based on Multiple Selection List box Mark as Not AnswerMark as Answer... Reply Contact Ah, I see. So, InfoPath has no rules-based way to add rows, unfortunately, and with a list form we don't have any of the options like adding default data rows and not using them. I don't know of a way to do this without third-party tools (i.e. the company I work for has a product called Qdabra Forms which has some functionality that would allow us to do this - more here: https://www.qdabra.com/en/products/qdabraForms.aspx#overview). Hilary Stoupa Page 1 of 1 (13 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Use our Google Custom Search for best site search results.
Hi,
I have a form with a multiple selection list box based on a secondary data source.
A user may check one or more items in that list box. I want to build a repeating table that populates the rows based on what is checked, and within each row, the user may specify other things about the row.
I attached an example to demonstrate what I am looking for.
For example, if I select Apple, only the Apple row is populated, and the user can further select a radio button.
If I select Apple and Lemon, those respective 2 rows are populated. Problem is that when I select the radio button, it automatically makes all the radio buttons the same selection.(I can't have one large one small)
I am new to InfoPath and I'm not sure it's because I'm doing something wrong or InfoPath doesn't handle this kind of functionality.
What are my other options? I'm open to recommendations.
Thanks!
Do you see how the option button control has a little warning that it can't repeat where you have it? The reason is the data structure in your form isn't correct. However, if we just add attributes to the repeating field that is bound to your multi-select, the attribute nodes aren't included when the new instance of the field is inserted when the multi-select is clicked.
This doesn't really surprise me - I've found multi-selects to be awfully flakey.
I'm attaching a sample that does what you want - save the file locally, right click and select design to look at it in design mode, then you can preview to try it. If you look under the data tab in the ribbon, you'll see I have added 3 instances of the repeating group by default, and set a value for field1 for each - and I mention this because while this technique (mimicking a multi-select) works ok when you know in advance what the options should be, it is more difficult if you were wanting to get your options from a SharePoint List or another external data source.
Thank you so much, Hilary!
I've looked at your sample attachment and have a few more questions if you don't mind.
- When you said "add attributes to the repeating field that is bound to your multi-select", what do you mean by attributes?
- While I like your solution of using a repeating table with separate controls to "mimic" a multi-select, my problem is just as you described. My multi-select is actually based on an external data source and the result changes depending on other sets of cascading drop downs that users are supposed to select prior to this.
I have a large list set up in SharePoint. Let's say the list contains 3 columns: Type, SubType, Segment. The multi-select is on the Segment, which changes depending on what Type and SubType the user selects first (these two are cascading drop downs). Hence my initial decision to use the multi-select control.
It would be really appreciated if you can show me how to set up default value using external data source.
Hi, Winnie:
- Multi-select controls are bound to a repeating field. We can't add fields to a field - only attributes. So, if you right click your repeating field in your main data source, and select add, you can add an attribute. But multi-selects are interesting in that when you make a selection, InfoPath inserts an instance of the repeating field for you, set to the value of your selection. It won't include the attributes (personally, I think this is a bug). So - even if you add attributes to the field that you can use to bind other controls, you end up with no instance of the attributes, which leaves the controls disabled. Experiment with this, and you will see what I mean. :)
- To use default data for this approach (make believe multi-select, like my sample) we need to have general idea of the maximum number of options that might be available. So - do you have an idea of the max number of segment options there might be for a given type & subtype? Is this something that would change often (i.e. - is this a list that has a lot of additions or deletions or changes happening?)
Hi Hilary,
- I see what you mean now! I understand that when you insert a new item in a repeating table, it would repeat the attribute as well, but for some reason it doesn't do that for multi-selects and it leaves the controls greyed-out. I agree that it feels like an InfoPath bug, but I guess that's just how Microsoft built it. :(
- Is 50 too large of a number? To be honest I don't know what the maximum # of segment there would be for each combination of Type&Subtype. This form is meant to be expandable such that people can add/remove as many entries as they'd like in the SharePoint list and the multi-select would display accordingly.
Thanks again for all your help!
Winniefred
I'm glad you had a chance to try it, that makes it easier to understand. 50 isn't necessarily too large, it somewhat depends on the complexity of your schema. Basically, you'll have to add as many instances of the repeating group as you think you'll need in the default data settings for the form. Then, the resulting XML will have blank nodes (which you'll be hiding via formatting) - it will make your files slightly larger than they really need to be. I'm attaching another sample. In this one, I added a data connection to an XML file that is a resource in the form, so you can see the basic approach I would take. If you are comfortable working with form source files, save your template as source files and you can add all your default nodes in template.xml instead of using the ribbon controls in the designer (I'd so much rather copy / paste XML). The trickiest formula is on the "set" attribute in the repeating group - select Edit XPath on that, and let me know if you have any questions.
Thank you so much, Hilary! Your example does exactly what I am looking to do!
So my understanding is the solution would be to repeat "group4" in your example for 50 times and set the "selected" attribute's default value to "false" for each.
What I am not clear on is the "set" attribute. Is this the formula to populate all the Segments based on the filtered results from selecting Type&Subtype? Why does it need to "divide by Segment" at the end of the formula?
Also, do I need to set a default value for the "set" attribute for all 50 instances? Or just the first instance?
I agree it'll be much nicer to copy/paste in the XML itself, but I'm not sure how to work with source files.
Thanks again!