Dynamic Multi-Select Listbox -- concat checked values into one string - InfoPath Dev
in

InfoPath Dev

Dynamic Multi-Select Listbox -- concat checked values into one string

Last post 04-16-2014 12:21 PM by Kimberly. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-17-2010 06:20 AM

    Dynamic Multi-Select Listbox -- concat checked values into one string

    Hello,

     I have a listbox and several values there. I need to concatenate checked values into a string and put this string into a textbox. I've read the thread http://www.infopathdev.com/forums/p/13888/49351.aspx, but actually haven't found the solution there.

     It's not the problem to concat values while checking (using rules). Updating the textbox after UNchecking is the problem for me (even using default value).

     Perhaps there's another way to solve the problem.

    Appreciate your help.

    Thanks.

  • 11-13-2013 08:56 AM In reply to

    Re: Dynamic Multi-Select Listbox -- concat checked values into one string

    Hi DmitryB,

    It took a while to figure out, but this is actually pretty quick to set up with out-of-the-box Infopath 2010 functionality.

    When you created the Muiltselect control, it should have been automatically bound to a Group (looks like a folder in myfields) and a Repeating Field (looks like a piece of paper with a blue arrow).

    • Where you want to display your concatenation, create a Calculated Value control.  This will prompt a window asking for the XPath. 
    • Click the fx button on this window.  This opens a formula window. 
    • Click the "Insert Group or Field" button and select the Group associated with your control  This is the key - if you select the Repeating Field, it will only display the first value in that field.  The Group will display all values in that repeating field.
    • Click OK.  This sets the XPath to "my:GROUP_SELECTED"
    • Click OK.

    Now when you preview the form, this Calculated Value control will automatically concatenate each selection checked or unchecked in your Multiselect control.  No need to manually refresh.

    Note: If you want the options to be delimited by something, modify the Values in your multiselect control to contain that delimiter.  This will not impact how the option displays in the multiselect control.   

    On my form, I manually entered values, so I can simply type the delimiter into the Multi-Select List Box Properties. For example:

    Value        Display Name  

    Option1;    Option 1

    Option 2;   Option 2

    Good luck!

    Kim

  • 04-16-2014 07:38 AM In reply to

    Re: Dynamic Multi-Select Listbox -- concat checked values into one string

    I am having trouble display the actual name of the item selected. All that is displayed is in the Calculated Value is a number. Each time I select a new item in the Multiple-Selection box, I get another number.  So if I select Orange and Red in the selection box I want to display Orange and Red, instead I get two numbers.  The multiple-selection box is a lookup field to a list in SharePoint. I am guessing that is my issue but not sure how to resolve this.   Any insight on this would be appreciated.
  • 04-16-2014 12:21 PM In reply to

    Re: Dynamic Multi-Select Listbox -- concat checked values into one string

    Hi snturner,

    I agree with your suggestion that the fact that this is a Lookup is causing the issue.

    Any SharePoint list auto-assigns a numeric unique ID to each row in the list.  Your lookup control by default will set that numeric ID to the Value for the control and whatever column you choose as the Display Name for the control.

    In the trick I suggested, manually entering the dropdown options allows you to set the ID to what is actually the Display Name. 

    Where are you trying to display the concatenation?  If you're sending the data to Access or Excel, SharePoint tends to send a hashtag delimited list of multiselect Display Names.  If it is a column in SharePoint, when you publish the InfoPath form, there is an option to display multiselect data as a count of choices or some kind of string (I have not tried it).

    But if you just need to display it in the InfoPath form itself, I don't know of an easy way to override the numeric IDs.

     Good luck,

     Kim

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