multiple selection list box: Show labels - InfoPath Dev
in

InfoPath Dev

multiple selection list box: Show labels

Last post 07-27-2015 12:55 PM by cafescott. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-21-2015 06:36 AM

    multiple selection list box: Show labels

    I am trying to show the user the labels chosen in a multiple selection list box (MSLB).  The MSLB has numeric values associated with each label.  It would be difficult to change the values of the MSLB to strings at this stage of the project.

    I have found that this bit of code shows the values chosen:
    eval(eval(multiselectfield[. != ""], 'concat(., ", ")'), "..")

    If I select the first three items in the MSLB, I get: 1, 2, 3.  Is there a way to substitute these values with the strings that the user is seeing?

    Thanks!
    Cafescott 

  • 07-22-2015 04:59 PM In reply to

    Re: multiple selection list box: Show labels

     This can be done! Where you've selected your multiselect, you'd select the field from the 2ds with the display instead, then you'd add a filter to that. I've done up a simple sample. Save it locally, right click and select Design, then preview and select some months...

    Hilary Stoupa

  • 07-27-2015 07:44 AM In reply to

    Re: multiple selection list box: Show labels

     Thanks for the reply, Hilary!  What I haven't been able to figure out from your example is how to include this part of the formula: Display[Value=field1]

    When I enter the "formula" dialog box for the calculated field, I type: eval(eval  .  Now I wish to add: Display[Value=field1]  .  I click on "Insert Field or Group." Then "Filter Data."   Then "Add."  I choose "expression", and change the condition to: Display[Value = field1].  I click OK a couple of times before getting this error: A filter cannot be applied to the currently selected field.

    So, is it possible for you to help me understand the secret in entering the crucial part of your formula?  Thanks.  :)

  • 07-27-2015 07:59 AM In reply to

    Re: multiple selection list box: Show labels

     Well - on your form, the XPath will be different, right? I selected "Display" from my secondary data source and then added a filter to it. You'd select whatever you are using for the display value in your multi-select list box and just use the UI to add a filter to it. :)

    Attach your form under the Options tab if you'd like me to give you a hand. 

    Hilary Stoupa

  • 07-27-2015 11:38 AM In reply to

    Re: multiple selection list box: Show labels

    Hilary, I appreciate your reply.  However, I still don't get how to put the formula in the calculated value field.  I created a copy of your project, so we are talking about the same XPath. 

    I create a second calculated value field and put it beneath the one you created.  I right-click to set the property.  I click the expression button.  I am in the "Insert Formula" dialog.  I can type almost the entire formula you have created, with the exception of Display[Value=field1].  That isn't obtained from a field.  If I type Display[Value = , and find the field1 from the schema, then finish the formula, I get an error.

    So I am confused as to how you put the Display[Value=field1] portion of the formula into the property of the calculated value.  Thanks!

  • 07-27-2015 11:49 AM In reply to

    Re: multiple selection list box: Show labels

     If you look in my form, you'll see that the Display field in the double eval formula is selected from the secondary data source. Is that what you are doing? If you look at my formula and click edit XPath, you can see the full XPath. That may help you.

    Hilary Stoupa

  • 07-27-2015 12:20 PM In reply to

    Re: multiple selection list box: Show labels

     Hilary, I can copy your X-path and paste it into the new calculated field, and I don't get an error.  However, did you initially edit XPath for the calculated field?  Or did you click on buttons like I have been trying?  If you clicked on buttons, I would love to know how you got the formula in its entirety into the calculated field.

    Sorry to be asking the same question, but I need to use your technique elsewhere.  If that formula is possible without editing Xpath, it would be nice to know how it is done.  Thanks!!

  • 07-27-2015 12:27 PM In reply to

    Re: multiple selection list box: Show labels

    I guess I'm not being very clear. I've been trying to tell you that to enter the Display field with the filter in the formula, I used the UI. I selected the secondary data source "Display" field, clicked "Add Filter" and added the filter by first selecting the "Value" field from the 2ds, then leaving the middle drop down as "is equal to" then selected "field1" from my main data source in the third drop down.

    Hilary Stoupa

  • 07-27-2015 12:55 PM In reply to

    Re: multiple selection list box: Show labels

     Hilary, thanks for the clarification! I finally understand how you created your formula. Hooray!


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