Count of Numbered List behaviors - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Count of Numbered List behaviors

Last post 04-09-2019 09:42 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-05-2019 09:37 AM

    Count of Numbered List behaviors

     I have a form where users enter items into a numbered list. I want the total number of items entered into that list to appear in another field as they update it. This can easily be accomplished using a Default Value of Count(List)


     I would also like the user to be able to override the total field with their own value, in case entering that many list items would be impractical. For example, they might write "1 through 100" in a single line on the numbered list, and then go and change the Total field to 100 instead of the 1 that is being calculated.

     The issue arises when the form is reopened after submit, and the default value is recalculated back to 1 as the form loads, even though the user submitted value of 100 is still stored. My thought was then to set the Total value with a rule on the numbered list, instead of using a default value on the total, and trigger the rule "when the field changes"

    The problem is the rule won't work correctly, as the Count will always return a value of 1 if it is set to run "when the field changes"

    The same rule applied to a button works with the expected result, but this is clunky and not aesthetically pleasing.

    Am I overthinking this? How do I get the form to total up a numbered list as it changes in real time (and allow the user to change it), but not on form load?

  • 04-09-2019 07:44 AM In reply to

    Will the user still be adding rows after they have entered their own value? If not, see attached - I added a rule to field1 instead of using a calc'd default in field2. If so, you may need a way to determine user intent, like adding a checkbox they can tick to indicate that they don't want the total overwritten, and you could then use a condition on the rule on field1 to take that into account.
    Hilary Stoupa

  • 04-09-2019 08:38 AM In reply to

    Re: Count of Numbered List behaviors

     Yes, this is pretty close! The behavior of the rule works differently in preview vs. in the browser however. :(

     In preview the total updates as you add or subtract line items from the list. In the browser, the total only changes when a line is added. If you add in 10 lines, then start deleting them, the total will stay at 10 until you add a line again.

     Also after around 50-75 iterations of the rule the form crashes with a "This session has exceeded the amount of allowable resources" error. Haha!

     Is there a good resource out there for a list of functions that don't appear in the all category of the function builder and their uses (such as preceding sibling)?


  • 04-09-2019 09:42 AM In reply to

    Re: Count of Numbered List behaviors

    Yuck. You might try setting postback to always on the list control - right click the control and under browser set the radio to always, see if that makes a difference? Any XPath reference will talk about preceding-sibling - I like this one:
    Hilary Stoupa

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