3 Replies Latest reply on Feb 25, 2012 2:05 PM by TerryCoolidge

    how do I test to see if a member belongs to a committee?

    TerryCoolidge

      Title

      how do I test to see if a member belongs to a committee?

      Post

       I am sending out an email to a found set of members to let them know what committees that have been assigned to.  I am using the List function to include an individualized list of committees for each member. I want to include an extra text string after the list for only those members who belong to a particular committee. I have figured out how to use an If function to either include or not include the text string based on whether the test is true or false by just using 1=1 vs. 1=2.  But I want to test to see if the member belongs to a particular committee.  Should I do some sort of text testing function on the text list (generated by the List function), or test for a committee_id number somehow?  I tried just saying "If Committee_Assignments::committee_id = 21," but that didn't work. I guess since there are multiple committee_id values stored in the Committee_Assignments table for each member?  How should I be approaching this? Thank you in advance!

        • 1. Re: how do I test to see if a member belongs to a committee?
          bumper

          I don't know anything about your schema, but if your List calculation is working then this should do the trick:

          Calculation field, result text

          If ( PatternCount ( CommitteList_L ; "CommitteeName" ) ≥ 1 ; "Your message would go here." ; "" )

          Note the message can also be data from a field. You can also have multiple committees by using the case function.

          • 2. Re: how do I test to see if a member belongs to a committee?
            philmodjunk

            For that calculation, I suggest a slight change:

            If ( ValueCount ( FilterValues ( CommitteeList_L ;"CommitteeName" ) ) ; "Your message" ; "" )

            In some cases, patterncount can return a non zero value because the second value "committeName" matches a portion of a value in the list.

            A name of John Smith, for example would match to the name John Smithson and produce a non zero pattern count. This will not occur with filtervalues.

            • 3. Re: how do I test to see if a member belongs to a committee?
              TerryCoolidge

              Thank you, both Bumper AND Phil.  I actually chose Bumper's answer as best because my list included committee names and sub-committee names, but I wanted to test for just a committee name.  I had calculated a new field prior to listing that concatenated committee_name and committee_role.  Testing for just "Sunday School" wouldn't work using FilterValues since now the list read "Sunday School: Teacher" or "Sunday School: Staff," etc.  Perfect instance of where PatternCount is useful.  However, I can totally see why Phil's solution is good to know about, so I'm extremely grateful to be aware of that option as well.  Thank you so much!