6 Replies Latest reply on Mar 27, 2017 6:53 PM by user19752

    PatternCount or ValueCount?

    dbice

      Hello,

       

      Is there a way to count occurrences of getting the same two values consecutively? I have 19 questions (using radio buttons) where testers can receive a score of 0 or 1, and I want to be able to be notified if a tester receives two scores of 0 in a row.

       

      Thanks!

        • 1. Re: PatternCount or ValueCount?
          KylePutzier

          PatternCount would work.

           

          e.g.

          PatternCount ( YourFieldHere ; "0¶0" )

          or

          PatternCount ( List(YourFieldHere) ; "0¶0" )

          1 of 1 people found this helpful
          • 2. Re: PatternCount or ValueCount?
            philmodjunk

            It would be simpler to put those results into separate records of a related table as then you don't have to parse a list of values. But are you sure that these are radio buttons and not check box fields? Only one value can be selected at a time in a radio button field unless the user holds down shift or ctrl. So perhaps you need to supply a bit more detail about what you are trying to do here.

             

            If you are actually using a check box field:

            PatternCount ( ¶ & YourCHeckBox & ¶ ; ¶ & 0 & ¶ & 0 & ¶ )

             

            should work.

            1 of 1 people found this helpful
            • 3. Re: PatternCount or ValueCount?
              dbice

              I created a field that puts all the questions in one field (e.g. Test_All is a calculation: Item1 & Item2 & ...), so I used PatternCount ( Test_All ; "0¶0") like Kyle suggested. This works well until I get to one question that uses a calculation (it's a multipart question) and I can't figure out why it isn't counted as a zero.

               

              You're right that I used checkboxes. I recently changed them from radio buttons so that answers could be deselected from the iPads.

               

              Are calculation fields excluded from PatternCount even if the calculation result is text?

              • 4. Re: PatternCount or ValueCount?
                philmodjunk

                Better look at the calculation result, the value that is to see what's different. All you need is one character wrong and this use of PatternCount will not produce the desired results.

                 

                BTW, my method was generalized  to work with more values than just 0 and 1. It your case, it makes no difference, but in others, not using leading returns like I do could identify a value such as "10" as a "0".

                • 5. Re: PatternCount or ValueCount?
                  dbice

                  Hmm, it's still giving me trouble, but I'll play around with it more. At least I know I'm on the right track. Thanks for your help!

                  • 6. Re: PatternCount or ValueCount?
                    user19752

                    In your case, the values are all 1 digit then you don't need separator.

                    (e.g. Test_All is a calculation: Item1 & Item2 & ...), there is no separator then use PatternCount ( Test_All ; "00")

                     

                    If you use checkbox with one value, you can unselect but it become empty, not 0. You'd need something like auto-enter

                    Self + 0

                    etc.