5 Replies Latest reply on Oct 15, 2012 8:28 AM by philmodjunk

    Calculation Help



      Calculation Help



           I have a table called "People".  on that table I have a field called TypeofPersonFlag which is a checkbox set with a value list I created.  All well there. 

           I have another field which I have called GPFullName for example; and I am trying to calculate that if  "GP" is marked in the TypeofPersonFlag checkbox that it gives the last name, full name of that person.  I thought it was simply :

           If( TypeofPersonFlag=GP; LName  &  ","  &   " "  &  FName; "")

           But I get an error message saying the specified field cannot be found and it highlights GP. 

           This is probably something really simple that I'm missing but as I'm new to trying to figure out calculations and filemaker in general i'm not sure what I'm doing wrong. 

           Thannks in advance for the help. 

        • 1. Re: Calculation Help

               You have two problems.  One is that the GP value you are comparing is not a field name, so must be in quotations:

               If( TypeofPersonFlag="GP"; LName  &  ","  &   " "  &  FName; "")

               You could simplify that to:

               If( TypeofPersonFlag=GP; LName  &  ", " &  FName; "")

               However you say that the TypeOfPerson is a check box.  Check boxes are used for fields that may have multiple values.  (If the person can only ever be one Type you should use Radio Buttons).  If the person is checked as being a 'GP' and a 'Consultant' then the TypeOfPersonFlag will not equal 'GP'.  It will equal 'GP[return]Consultant'.

               You can use the PatternCount function to determine is their Type contains 'GP'.

          • 2. Re: Calculation Help


                 Thanks for the response.  I'm using a checkbox because I do want to be able to select more than one option if applicable. 

                 What do you mean use the patternCount function?  Sorry, this is all new to me

            • 3. Re: Calculation Help

                   Then you cannot use the If( TypeofPersonFlag=GP...) test, as the person could be marked as a GP but that will evaluate to false if they are also marked as something else.


                   If ( PatternCount ( TypeofPersonFlag ; "GP" ) ; LName  &  ", " &  FName ; "" )

                   Note that if any of the other options in the checkbox contain the character sequence 'gp' this will not work.

              • 4. Re: Calculation Help

                      I think I got it, thanks. 

                • 5. Re: Calculation Help

                       If ( PatternCount ( TypeofPersonFlag ; "GP" ) ; LName  &  ", " &  FName ; "" )

                       Works with many value lists, but can fail with certain possible values. If "GP" is contained within the text of another value in the value list, for example, Pattern count will return true when that other value is selected just as though "GP" had been selected. If that's not a possibility, you can ignore the rest of this post if you want, but there is another function that does not have this potential issue:

                       If ( Not IsEmpty ( Filtervalues ( TypeOfPersonFlag ; "GP" ) ) ; LName  &  ", " &  FName )