4 Replies Latest reply on Jul 8, 2010 8:31 AM by philmodjunk

    Count()

    Jon1009

      Title

      Count()

      Post

      Hello iam trying to do a calculation that counts the number of times a word appears in related records


      Iam using a calculation field

      I want to count Tests::Test Type for the word DSP

      Cant seem to figure it out

      Cheers

      Jon

        • 1. Re: Count()
          philmodjunk

          Set up a "flag" field in Tests such as:

          PatternCount ( Test Type ; "DSP" ) > 0

          Now you can use the Sum function defined in the parent table to count your related records or a Total of Summary field defined in Tests could be used to get the same value.

          • 2. Re: Count()
            Jon1009

            How would I go about counting two different fields

            For instant Test Type = DSP and Status = Awaiting Result

            • 3. Re: Count()
              Jon1009

              Ah managed to figure it out by doing

              PatternCount ( Test Type  &  Status ; "DSP" & "Awaiting Result")> 0

              Thanks for you help yet again :)

              • 4. Re: Count()
                philmodjunk

                That checks your two combined fields for the string: DSPAwaiting Result. That will work if the fields contain one instance of DSP at the end of Test Type and one instance of Awaiting Result at the beginning of Status.

                I think you want something more like this:
                ( PatternCount ( Test Type ; "DSP" )> 0 ) AND ( PatternCount ( Status ; "Awaiting Result")> 0 )