5 Replies Latest reply on Feb 25, 2014 7:57 AM by thomasseidler

    ValueCount has a minor error to be aware of!!!

    thomasseidler

      Summary

      ValueCount has a minor error to be aware of!!!

      Product

      FileMaker Pro

      Version

      12 and 13 tested

      Operating system version

      Mac OS X 10.9.1

      Description of the issue

      ValueCount misses the last value if it is blank. Which is unhelpful in the event you are trying to determine if two lists are of equal length, you want to count null/empty values too...

      Steps to reproduce the problem

      ValueCount( "0¶¶2¶3¶4") & ¶ &
      ValueCount( "0¶2¶3¶4¶")

      Expected result

      5
      5

      Actual result

      5
      4

      Workaround

      My own custom function:

      VC ( _valueList ):

      PatternCount ( Substitute ( _valueList ; "\¶" ; "" ) ; "¶" ) + 1

        • 1. Re: ValueCount has a minor error to be aware of!!!
          TSGal

               Thomas Seidler:

               Thank you for your post.

               The ValueCount function will not count the last value if blank.  The Help says that the last value will be recognized with or without a carriage return.  Since there is no value in the last entry, the previous entry will be counted.  This has occurred since FileMaker Pro 7.  For more information, see page 317 of the FileMaker 13 Functions Reference at:

          https://fmhelp.filemaker.com/docs/13/en/fmp13_functions_ref.pdf

               If you expect your lists to contain a last blank entry, then your workaround is recommended.

               TSGal
               FileMaker, Inc.

          • 2. Re: ValueCount has a minor error to be aware of!!!
            philmodjunk

                 This is one of the reasons that it can be useful to use the list function to build your list in the first place. Since list omits empty list members you won't have an added return with no value in your list.

            • 3. Re: ValueCount has a minor error to be aware of!!!
              thomasseidler

                   I regularly use repeating fields (I know, I know! - only use them for graph/reporting data...), and occasionally in my custom lists/dictionary stuff I 'zip' two value lists together, to form dictionaries - i.e. key value pairs - and i tend to error check - does value count of one equal the other... But hey, I appreciate this probably effects no one but me, though I still think it is irrational because it is inconsistent behaviour.

                   I re-read the help section as you directed (thanks TSGal), to quote in context:

                   

              A value can be empty, a single character, a word, a sentence, or a paragraph. When you press Return you start creating a new value [which can also, we presume, be empty]. The last value will be recognized with or without a carriage return.

                    

                   It should then read: "...Thus, while you can have an empty value, it only counts as a value when it is not the last value."

                   I would say there is an inherent contradiction and confusion in the help page and value counting as it stands? Whaddya reckon? To have empty values as valid in all places except the last, is not perhaps the most helpful?

                   PS I should probably add that those who want to kill trailing returns happily use Trim4 by Ray Cologon, and StripEmptyValues where necessary...

              • 4. Re: ValueCount has a minor error to be aware of!!!
                TSGal

                     Thomas Seidler:

                     I can definitely see the confusion, so I have sent your post (including suggestion) to our Documentation Manager for review.

                     TSGal
                     FileMaker, Inc.

                • 5. Re: ValueCount has a minor error to be aware of!!!
                  thomasseidler

                       You are most gracious as ever TSGal. Blessings, Tom

                       PS maybe i shouldn't have selected answer, to imply it's solved, but it seemed the most appropriate... until Version 14/15 at least this will be with us! ;) So until then, it's the best answer!