5 Replies Latest reply on Aug 11, 2016 9:54 AM by coherentkris

    Booleans in formulas


      In conditional formatting, using the content of another field as condition input in a formula. If, to change the format of "table_1::field_A", I use "isEmpty(table_1::field_B)", this function returns a boolean, and the conditional formatting works. But if I simply use in the formula "table_1::field_B", according to the formula window it also returns a boolean: true if not empty; but then the conditional formatting doesn’t work. In both cases, according to the formula window, the result is a boolean, but the conditional formatting behaves differently.

      Please, what am I missing?

        • 1. Re: Booleans in formulas
          David Moyer


          How is table_1::field_B defined?  It seems like it would have to be a number to evaluate properly.  Typically, Boolean is zero and non-zero, as opposed to empty and not empty.  Does that guide you anywhere?

          • 2. Re: Booleans in formulas

            "Pure" Boolean is 1 or 0. However, FileMaker allows for 0, 1 or "" (empty). While I have been known to use that "feature", if you validate the field to always have the 0 or 1, (set data to 0 by default?), then you will never have an empty.


            0 ≠ "" (empty)




            • 3. Re: Booleans in formulas
              David Moyer

              true (1), but obviously FileMaker lacks a Boolean variable type.  So, in FileMaker, zero is false, non-zero is true.  To deal with empty number fields, I use (myNumber > 0) to provide a Boolean 1 or 0.

              • 4. Re: Booleans in formulas

                Thank you Beverly and David.

                The field type of the condition input was text, the behavior of this conditional formatting is unpredictable unless using the function isEmpty().  I tested with a number field, then the behavior was predictable: empty or 0 = false without using any function.  So the return status of the formula window should display "undefined" when a raw text field ( "table_1::field_A" ) is used as input for conditional formatting.

                Could it be that booleans are internally represented by numbers, and that a function is required to make a type casting if the field is not already a number?

                • 5. Re: Booleans in formulas

                  To expand on Bevs response..

                  You can also test using built in constants true and false where true = 1 and false = 0