Count of checked boxes in a Multiselect - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Count of checked boxes in a Multiselect

Last post 03-06-2023 11:42 AM by seraphim_72. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-02-2023 07:02 AM

    Count of checked boxes in a Multiselect

    So here is what I am running into. Create a list add a multi-select with three choices. Then make an InfoPath form out of it. Add a text box and try to get that text box to reliably tell you how many boxes have been checked both on creation of a list item, and on edit of an item. It should be a simple count(value) of the multi-select, which doesn't work. Now I have the 'Some Total' with the Default set to count(value) [Really xpath--- count(../my:SomeChoice/Value)]and a rule on 'Some Choice' to set 'Some Total' to count(value) [ Really xpath---  (count(/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:SomeChoice/Value)].  At creation for some reason the index starts at one so that if you check all three boxes the count is four.

     



    Easy you say - just make it count(value) -1 ! And that works, on creation, but not on edit of an existing one.

    Anyone got a clue?

  • 03-02-2023 07:34 AM In reply to

    Re: Count of checked boxes in a Multiselect

     Ah, I think I see part of my problem. InfoPath does not see unchecking a box as a change. Only boxes getting checked are a change.

  • 03-02-2023 04:47 PM In reply to

    Re: Count of checked boxes in a Multiselect

    That's right - I've seen the same issue with multiselects. Usually if I need a count I add it to the Submit button or something - but in terms of showing the user that info, you are sort of out of luck. So you know, there is generally a default blank instance of the repeating node in InfoPath - that's why you are seeing the weird behavior of getting a count of 4 when 3 are selected. I usually add an XPath filter to exclude blanks. I loathe multi-selects, they behave differently than everything else!!
    Hilary Stoupa

  • 03-06-2023 11:42 AM In reply to

    Re: Count of checked boxes in a Multiselect

     Thank you Hilary - you are the best!

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