4 Replies Latest reply on Oct 5, 2013 2:04 PM by StanValnicek

    Sum values of checkbox field

    StanValnicek

      Title

      Sum values of checkbox field

      Post

           I have a checkbox list with several entries that have different numerical weights.  I can sum the number of checkboxes "checked" but instead I would like to sum the values of the numerical labels of the checkboxes in the field.  The values range from 1 to 3 and represent a score for individual choices to be checked off.  Is this possible to calculate a "total score" based on the checkbox labels?

           Stan

            

        • 1. Re: Sum values of checkbox field
          philmodjunk

               In some cases, it may make more sense to replace your single field with a set of related records, but this expression will do what you have requested:

               Evaluate ( Substitute ( YourCheckBoxFieldHere ; ¶ ; "+" ) )

          • 2. Re: Sum values of checkbox field
            StanValnicek

                 Works like a charm - thank you so much!

                 Stan

                 PS: Since i am a noob at FM and only if you have time - why or how does this expression do its thing?

                  

            • 3. Re: Sum values of checkbox field
              philmodjunk

                   Evaluate takes text such as "5 + 6 + 3" and evaluates it as though this were an expression in the Specify Calculation dialog. The substitute function replaces each return character (¶) in the field with an addition operator "+" to produce such an expression. A field with a check box format stores each value selected with a return character separating each selected value from other selected values, so that's where the return characters come from.

                   You can look up each of these functions in FileMaker help to learn more and you may find it educational to make a copy of your check box formatted field and then change the copy back into an edit box. When you click check boxes in the first copy, you'll see what data is actually being inserted into the field in the edit box copy and you may find this to be enlightening.

              • 4. Re: Sum values of checkbox field
                StanValnicek

                     Thank you again.  I tried to find the evaluate function in the help menu but it does not really provide much info.  I really appreciate you taking the time to explain how this works.