6 Replies Latest reply on Jul 10, 2015 6:58 AM by philmodjunk

    Why does my boolean field acquire a value of "No"?

    cosmocanuck

      Title

      Why does my boolean field acquire a value of "No"?

      Post

      I am having the strangest problem and will try to explain.

       

      I have scripted find which, among other things, searches a boolean field. I want to find records where this field is empty, thus I'm using “==“ as the find parameter. 

       

      However, some fields appear to have a value of “No” instead of the desired empty or null value. Thus,  they’re missed in the above find.

       

      First problem: I can’t understand why some fields are even getting the “No” value. As far as I know I’ve done everything correctly to ensure it’s always either “1” or nothing.  In the table, it is set as a number field, and on the only layout where the user can modify this field, it is set as a checkbox set linked to a value list with only a single choice of “1”, with the Data Formatting option set to Boolean, “show non-zeroes as” set to 1, and “Show zeroes as” left blank. All this is, as I understand it, best practice for a boolean checkbox. 

       

      Yet, when I add a new record, and don’t check the checkbox, then go to layout mode and change it to a text field and click on it,  the word “No” appears!  The field is completely empty until I click it.

       

      Why might this be happening? I assume I’m doing something wrong, but… what?

       

      Thanks!

      adam

        • 1. Re: Why does my boolean field acquire a value of "No"?
          philmodjunk

          There is no such thing as a true Boolean field in FileMaker. We end up using either a number or a text field to store a Boolean value. It sounds like you are using a field of type Number--which is the best option. But it also sounds like you have either a script trigger or (more likley) a auto-enter field option that is entering the text "No" into the field.

          Since the field is normally formatted as a check box, you won't see values in the field that do not match a value specified in its value list, but the data will remain present in the field.

          • 2. Re: Why does my boolean field acquire a value of "No"?
            cosmocanuck

            Since the field is normally formatted as a check box, you won't see values in the field that do not match a value specified in its value list, but the data will remain present in the field

            That makes sense.  I've ruled out script triggers, but I did have the 'auto-enter data' option checked in the field setup. However, it was set to "0", not "No". Anyway, I unchecked that option entirely, then I added a new record... changed the checkbox to an edit box... and it still had "No" in it!!!

            ???

            • 3. Re: Why does my boolean field acquire a value of "No"?
              cosmocanuck

              I can always modify my find to look for either no value in that field OR the word "No", but it sure would be nice to be able to prevent the latter from sneaking in there, however it's happening....   frown

              • 4. Re: Why does my boolean field acquire a value of "No"?
                philmodjunk

                "NO" also can be the specified data format display for zero or false on the data formatting tab of the inspector. But this will not affect what you see when you click into that field. Some option or setting is adding that value to the field. I'd take another look at script triggers. Try creating a brand new layout based on the same table and then putting a brand new copy of this field on the layout and testing it there. IF you still bet "No", then some auto-enter feature becomes the prime suspect here.

                • 5. Re: Why does my boolean field acquire a value of "No"?
                  cosmocanuck

                  Phil, I feel I should almost apologize for this... the button I had set up called "Add New Contact" (Contacts is the table we're talking about here) had a script step setting the value of that field to "No"!

                  Super head-slappingly obvious in retrospect.... I'd just been mindlessly clicking that script to generate new records for testing.... without checking its script!

                  Oh well.... live and learn.  Thanks!

                  • 6. Re: Why does my boolean field acquire a value of "No"?
                    philmodjunk

                    I think those of thus that are attending DevCon in a few weeks will be able to recognize each other by the hand shapped dents in our foreheads. wink