writing values from a multiple-selection list box to another control - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

writing values from a multiple-selection list box to another control

Last post 05-02-2014 08:54 AM by Joy_T. 46 replies.
Page 1 of 4 (47 items) 1 2 3 4 Next >
Sort Posts: Previous Next
  • 02-24-2010 08:34 AM

    writing values from a multiple-selection list box to another control

    Hopefully someone can tell me whether this can be accomplished using a rule or if I'm going to have to write some custom code. What I have is a multiple-selection list box that pulls values from a data connection to an XML file. The list box contains all the available hospitals and what I'd like to have is a text box that can populate all the user's selections. So, on a print view of the form I want a text box that contains all the selections made on the multiple-selection list box, concatenated.

     I've seen a couple posts out there that are similar to my requirements, but I need to know if this is something I can use a rule to accomplish or if it can't be done OOTB.

    Thanks in advance for any help :)

  • 02-24-2010 03:16 PM In reply to

    Re: writing values from a multiple-selection list box to another control

    See attached template sample (right click the link in the heading to this post, save locally, and then right click the file and select Design to open in design mode and preview)

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 03-03-2010 07:18 PM In reply to

    Re: writing values from a multiple-selection list box to another control

    Hilary,

     This is great! Thanks for the tip. If I use a datasource, like an XML file for instance, to populate the checkboxes, will it still work? I guess that's where I've been hitting a roadblock. I will try it using this method, but perhaps you know if that's doable OOTB?

    I have basically several of these multi-selection list boxes, one for each region of the country let's say and in it are hospitals that exist in that region. So, the northeast has 20-30 hospitals, southeast has 30-40, etc. My XML file populates each list box with the choices. One trick I did take from another one of your posts was to use the Plain List Box control on the view that I needed to see output and it allowed me to grab all the selections. This works great for my print view, but the technique you're showing me in this template would be great to write files to another control to pass onto a workflow or something like that.

     Let me know if this is possible using the datasource. Thanks so much! :)

  • 03-03-2010 07:57 PM In reply to

    Re: writing values from a multiple-selection list box to another control

    n/m got it working, turns out the problem wasn't the datasource (obviously), but the fact that the template was using a text box and not the expression box.

  • 06-16-2010 04:13 PM In reply to

    • darden
    • Not Ranked
    • Joined on 06-16-2010
    • Posts 6

    Re: writing values from a multiple-selection list box to another control

    Hello,

    Is there a way to use a text box rather than an expression box?  I want to publish the concatenated selected values, separated by semicolons, into a column on a SharePoint form library.

    Thanks

  • 06-17-2010 07:05 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Yes, you should be able to do this with a textbox.  Add a rule to the multi-selection list box's field to set your text box's value to the necessary formula, and also use the same formula for the default value of that field.  The rule will only run when an item is checked, and the default value will only evaluate when an item is unchecked.  One of the quirks of multi-selection list boxes.

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
  • 06-17-2010 07:32 AM In reply to

    • darden
    • Not Ranked
    • Joined on 06-16-2010
    • Posts 6

    Re: writing values from a multiple-selection list box to another control

    Jimmy:

    Yes, you should be able to do this with a textbox.  Add a rule to the multi-selection list box's field to set your text box's value to the necessary formula, and also use the same formula for the default value of that field.  The rule will only run when an item is checked, and the default value will only evaluate when an item is unchecked.  One of the quirks of multi-selection list boxes.

    Thanks Jimmy,

    I tried that, but it is still not working.  The textbox only shows the last selection I make.

    I am using the EvalSample that was posted, where the result is shown on an expression box.  I just added a textbox and copy the same formula used on the expression box on both the default value of the textbox and as a rule on the multi-selection list box.

    I attached the file, in case that helps to clarify the issue.

    Thanks again for helping!

  • 06-17-2010 08:07 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Here ya go.  The problem that was preventing it from working was that the formula on the rule for field1 was referring to field1 as . (dot).  You want the formula to evaluate on all instances of field1 (except the blank ones), so the path to use is ../my:field1.

     I also did some touchups to prevent extraneous semicolons at the beginning and end of the list.

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
  • 06-17-2010 08:13 AM In reply to

    • darden
    • Not Ranked
    • Joined on 06-16-2010
    • Posts 6

    Re: writing values from a multiple-selection list box to another control

    You are awesome!!! Thanks Jimmy. I was days trying to solve that issue!!!!

  • 09-21-2010 05:32 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Afternoon.

     This is something along the line as what I am trying to do,but I am having some problems in achieving, i've messed and messed with the eval sample that jimmy has done, however my text box still only updates with the last value selected - what am I doing wrong?

     Thanks.

    Pete

     

  • 09-21-2010 05:59 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Could you show us the formula you're using, with the Show XPath option selected?

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
  • 09-21-2010 06:32 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    That strange thing happened - where as I tried it again after making the above post and it worked! 

     maybe my fresh mug of coffee helped...

    thanks for the reply though, Jimmy.

  • 09-27-2010 06:00 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Jimmy,

       I had a very similar problem and I'm looking at the code in the template you provided...and it works...but in my case I want to show the display name not the value of the checkbox.  Is there a way to do that?   Any help would be appreciated.

     

     

  • 10-07-2010 08:31 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    Hi Jimmy,

     When I used this solution for the multiple selection lookup field. It returned the ID of the items in the selection list instead of the display name. Is there any way to get the display name of the selected items?

  • 10-08-2010 06:43 AM In reply to

    Re: writing values from a multiple-selection list box to another control

    This example has a formula that uses the display values instead of the actual values.  For simplicity, I've placed the list of available values in the main data source, but typically you would want them to come from a secondary data source.

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
Page 1 of 4 (47 items) 1 2 3 4 Next >
Copyright © 2003-2014 Qdabra Software. All rights reserved.
View our Terms of Use.