Multiple Selection Listbox - Get Index number? - InfoPath Dev
in

InfoPath Dev

Multiple Selection Listbox - Get Index number?

Last post 05-12-2016 03:27 PM by Hilary Stoupa. 24 replies.
Page 2 of 2 (25 items) < Previous 1 2
Sort Posts: Previous Next
  • 05-11-2016 05:03 PM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    I'm confused! So - is the count the total of selected field offices? It isn't like this multiselect is inside a repeating section or something, right? The count is just a ... running count?
    Hilary Stoupa

  • 05-12-2016 07:19 AM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Hi Hilary, thanks for getting back. I want to build a string that has all of the selected field offices delimited by a running count, so something like this: Colorado Field Office1Kansas Field Office2Nebraska Field Office3. My Multiple-selection list box is named "Field Office", in the Advanced view of my fields it looks like a folder, with "Value" MSLB inside of it. This works to build a comma delimited list: eval(eval(Value, 'concat(., ", ")'), "..") and this works to provide me with a final count: count(Value[. != ""]) so I thought I could put the two together to get what I want, like this: eval(eval(Value, 'concat(., count(Value[. != ""]))'), "..") However, I get a message that the formula has errors. Lara
  • 05-12-2016 08:12 AM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    See attached - there is a rule on a button that sets another field that I think does what you want.
    Hilary Stoupa

  • 05-12-2016 11:00 AM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Hi Hilary, That works great in the form you sent, but when I try to implement it on my form, it doesn't work, and I get "The formula contains one or more errors". I've tried it as a rule on the Field Office control, and as a default value in my receiving text box field. Is there a specific reason why you put it on a button? Also, in my Fields, I have several layers starting with: myFields > dataFields > my:SharePointListItem_RW > Field Office > Value. Is there a problem hidden in there somewhere, do you think? I'm rather new to this, but think I'm really close, since the other two formulas (double eval and count) work independently. I wish I could upload my form to you, but I'm not able to. Thanks again for your time! Lara
  • 05-12-2016 11:32 AM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    I should also say that all of these (myFields > dataFields > my:SharePointListItem_RW > Field Office > Value) except for my:SharePointListItem_RW are locked. Not sure if that matters.
  • 05-12-2016 11:38 AM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Can you copy the XPath for the "Value" field? Set the Fields pane to advanced view, right click on the Value node and select "Copy XPath"?
    Hilary Stoupa

  • 05-12-2016 12:54 PM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Here it is: /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:group1/Value
  • 05-12-2016 02:57 PM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    This works for me (pick the initial "Value" with the field picker): eval(eval(Value[. != ""], 'concat(., count(preceding-sibling::Value[. != ""]) + 1, ", ")'), "..")
    Hilary Stoupa

  • 05-12-2016 03:20 PM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Yahooo!! That worked! Thank you SOOO much!! Wow, so I'm trying to understand what made the difference. I realize I forgot the incrementer "+ 1" in my original try, but don't quite understand why your original formula didn't work. It looks like the only difference was not having the "my:" before the second value. Can you explain, or is this just a case of very sensitive formatting rules. Lara
  • 05-12-2016 03:27 PM In reply to

    Re: Multiple Selection Listbox - Get Index number?

    Your "Value" node didn't have a namespace prefix. My "field2" node did - the "my:" prefix. That's why I asked for your exact XPath - so the XPath to the preceding sibling was correct.
    Hilary Stoupa

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