Tuesday, August 28, 2012

Using Multiple Selection List Box control in InfoPath 2010

Multiple Selection List Box control acts like a list box which can be populated with values stored in a SharePoint list while rendering items with a check box in front of them at the same time.

Here, we will look into two capabilities of this control which are not very straight forward:

  • Retrieving all selected options with a delimiter
  • Show/Hide input details mapped with one of the item in control

Retrieving all selected options with a delimiter

Let's say, you have the requirement of getting all selected items from Multiple Selection List Box control and need to promote these to SharePoint form library.

(To promote this control value, you select 'merge' from drop down at the time of property promotion.)

Here comes the problem !

You may find promoted values unexpected as selected values are merged without any separator/delimiter. This control doesn't provide any option for putting a delimiter between merged values.

To achieve this, you need to work with expressions in InfoPath.

At the time of Submit,
- Create a rule to store provided expression (below) in any hidden control.
- Promote hidden control to SharePoint form library instead of multiple selection list control.

substring(eval(eval(lbControl[. != ""], 'concat(", ", .)'), ".."), 3)     // Store this into hidden control

It is using eval function of InfoPath which iterates through every item of list box control and put a prefix ", " with item if selected. lbControl is our list box control.

Show/Hide Input Details mapped with one of the item in control

Let's say, we have a requirement of making a control (text box, drop down list etc.) visible or invisible based on selection of a particular item in multiple list box control.

Put your target control in a section and create a formatting rule on section saying like this:


b.) And, if above condition is true, then hide the section.

lbRequestType -> This is your multiple selection list box control
"IT Department" -> It is an item populated in multiple selection list box control.


  1. What if the "All occurances of ___" is not coming in the dropdown

    1. It's default functionality. Is not coming in your case?

    2. Thanks for the blog. It helped me.
      If you can't find all occurrences in the drop down list select "Select a field or a group", then choose your multi-select-box and select all occurrences from the drop down list

    3. hi I am trying to follow your steps for "Show/Hide Input Details mapped with one of the item in control" but I don't understand. I have a mlsb and I want it where if one of the checkboxes is selected then a text field outside the mlsb becomes unhiden. The condition/ rule you have for "All occurences of mlsb" is only available when I click on the mlsb itself - how do I get that to apply to a text box or section not part of the mlsb? If I follow what you have it ends up hiding the mlsb itself

    4. You can get the "All occurences of..." option if you select the "The expression" option and enter: ../my:group1/my:Field[. != ""]
      (replace path with your multi-selection field of interest).

      Hit "OK" and you'll see that "All occurences of..." will appear listed in the conditions and the option is now available in the dropdown. Proceed to select the conditions without further messing with code.

  2. Hi, I was using a similar formula, except with a 2 instead of a 3 for the trimming. It seems to work. What is the diff?

    substring(eval(eval(lbControl[. != ""], 'concat(", ", .)'), ".."), 3)

  3. A related question - what if you want returns between the values?

  4. Hi Youdhbir,

    I am facing a similar problem:

    On the one side I have a SharePoint list containing a Choice field allowing multiple selections (e.g. Marketing, Sales, Construction). On the other side there's an InfoPath form that should load the checked values from one entry of my SharePoint list (e.g. Sales AND Construction).

    When trying to access the values over a data connection in two different ways, my result is either this one (the given result just contains the first value):


    x Sales


    or that one (the given result is not ticking the single values, InfoPath creates a new value...):




    x SalesConstruction

    Unfortunately, I haven't found a solution to display my list entry the following way in the InfoPath form:


    x Sales

    x Construction

    Do you have any idea of how to solve this problem?