7 Replies Latest reply on Mar 25, 2016 2:58 PM by Extensitech

    How can I store a radio button value as a boolean?

    GregoryLypny

      Hi everyone,

      I have a radio button set that displays Yes and No from a value list. I'd like the number one to be store when Yes is selected and zero to be store when No is selected. How can I do that?

      Regards,

      Gregory

        • 1. Re: How can I store a radio button value as a boolean?
          keywords

          One way would be to make the values boolean in the first place, but you have to fake it a bit. You can set boolean values to display  as 1 = yes and 0 = no, but unfortunately you can't do this with radio buttons. Here is a way around this:

           

          1.     Create a boolean value list with the values 1 and 0.

          2.     Place a field on the layout using this list as a radio button set, but size the field such that only the two radio buttons themselves are visible.

          3.     Place a text label alongside and aligned with the buttons, with the text Yes and No.

           

          From the user's perspective all they will see is the radio buttons, one labelled Yes, the other No. From the operational perspective, the upper button will enter a 1, the lower one will enter a 0 in the field. The attached screenshot shows how to set this up. As noted, element 3 show what is actually in the field, but you wouldn't include this on your layout.

          Screen Shot 2015-11-10 at 11.22.50 am.png

          If you are committed to using the text values as your value list, another technique would be to create a second calc field which converts a yes in the radio button field to 1 and a no to 0. Something like: If ( radiobuttonfieldvalue = "yes" ; 1 ; 0 ), with the result stored as number.

          • 2. Re: How can I store a radio button value as a boolean?
            Markus Schneider

            you have to fake it a bit.

            - define the field as number

            - define (inspector) the values for boolean to be shown as Yes/No

             

            this approach works as is - but not with radio buttons - so, You have to use a dropdown list or use the 'double-hidden-field - technic', having the field two times on the layout, one time as radiobuttons (values not shown) and one time as a number field that shows 'Yes' or 'No'. The second field is locked, no entry

            • 3. Re: How can I store a radio button value as a boolean?
              beverly

              I do similar, only I have TWO value lists. One has '1' and the other has '0'. Then I place the same NUMBER field on the layout TWICE. They are both "radio button" styled, but have the two different value lists. If they are "shrunk" to just show the circle, they can be placed as keywords have them or placed side-by-side with any text label (Yes/No, True/False, etc.).

               

              Even though it has two value lists, the field(s) still behave as radio buttons should. This solves the problem of precise placement of those circles.

               

              The same can be done with checkboxes (assignment with multiple "value-lists" with one value each). Then placement can be be as needed (in line, vertically, or any placement that is needed!)

               

              HTH,

              beverly

              • 5. Re: How can I store a radio button value as a boolean?
                lkeyes

                So, do you think we'll ever get a boolean data type, and boolean check boxes like every other database system I've ever worked with for the past 20 years?    :   Maybe in Filemaker 17. 

                • 6. Re: How can I store a radio button value as a boolean?
                  beverly

                  I don't need a Boolean data type, just Boolean evaluation (true/false) and we have that.

                  a single checkbox with value list of 1 will toggle boolean.

                  • 7. Re: How can I store a radio button value as a boolean?
                    Extensitech

                    Why not just show the user a yes/no radio button, on a text field, but then have a calculated number field equal to

                     

                    Case (

                        TextField = "Yes"

                        ; 1

                        ; TextField = "No"

                        ; 0

                    )



                    ?

                     

                    Chris Cain

                    Extensitech

                    1 of 1 people found this helpful