1 2 Previous Next 25 Replies Latest reply on Nov 9, 2010 11:44 AM by TylerRains

    Checkbox help

    TylerRains

      Title

      Checkbox help

      Post

      Im new to FileMaker and just need a little help:

      Im  trying to make a checkbox represent a value. For Example fo the particular project Im working on when I select the checkbox label Single I want the value to be 60 in the open field above the box. Is there anyway I can make that happen without mannually putting in all the information? Simplistic steps, really dumb it down, im usually good at this stuff, but this has me stuck.

      thanks in advance

        • 1. Re: Checkbox help
          philmodjunk

          A key question: do you have multiple checkboxes for a single field? This can make a difference in how you do this.

          There are quite a few different methods you can use for this.

          1. You can set the number field to look up the value from a related table--useful if the value entered may change in the future such as if this is a purchase price for an item.
          2. The number field can be a field from a related table placed on your layout with the relationship based on the value or values in your checkbox field. Similar to option 1, but changes in the related table automatically appear in all existing records on your main layout.
          3. You can create a calculation field that returns the desired value based on the value or values selected in the checkbox field--result is read only.
          4. You can set up an auto-entered calculation that puts 60 into the field when the box is clicked--this allows people to edit the 60 into something else if that is needed.

          The exact details for implementing any of these depend on what you want to do and how your check box field is configured.

          • 2. Re: Checkbox help
            TylerRains

            I think what im looking for is what you described in 4.

            What exact steps would I go though for that?

            • 3. Re: Checkbox help
              philmodjunk

              Depends on whether you have just one check box or several defined for your checkbox field.

              Assuming a single value:

              1. Find the definition for your number field in Manage | Database | fields and double click it.
              2. Select the auto-enter tab, select the by calculation option and enter:  If ( Not IsEmpty ( CheckBoxField ) ; 60 ; Self )
              3. Click OK, and decide whether or not to clear the "do not replace existing value..." option.
                If you clear it, the field will always read 60 if the check box is selected, to enter a different value, you have to clear the checkbox field first. If you don't clear it, clicking the checkbox after a value has been entered into the number field won't change the contents of the number field.

               

              If you have multiple check boxes, the auto-enter expression gets more complex.

              • 4. Re: Checkbox help
                TylerRains

                I do have more than one, how much more complex is it?

                you are being a huge help btw I cant thank you enough

                • 5. Re: Checkbox help
                  philmodjunk

                  We just have to add a different function to check and see if the right value was selected.

                  If ( Not IsEmpty ( FilterValues ( CheckboxField ; "YourValueHere" ) ) ; 60 ; self )

                  This approach ignores all other values that might be selected by clicking a different check box.

                  If you need to enter different numbers for different values then we'll need to modify this even further, perhaps with a Case function instead of IF.

                  • 6. Re: Checkbox help
                    TylerRains

                    Do I need a different checkbox field? because I added it however no matter which I select it says 60

                    • 7. Re: Checkbox help
                      philmodjunk

                      As written, the expression enters 60 if you select the value you've designated for this. If you select a different value, the number in the field will remain unchanged. THus, if you select the first value, you'll see 60 appear in the field. If you then click a different check box, you'll still see 60 in the field as the field will now remain unchanged.

                      I think you should describe each checkbox in your field and what you want to see appear in this number field when each checkbox is clicked. Of particular importance: what do you want to see happen if a combination of check box values are selected?

                      • 8. Re: Checkbox help
                        TylerRains

                        well in this particular case it is one of two choices, either single (desired result being 60) or couple (desired result being 50)

                        however I have a similar problem where I want the number of boxes selected out of 12 to be shown in a field below.

                        • 9. Re: Checkbox help
                          philmodjunk

                          I'd make that first field a radio button set rather than check boxes since selecting both single and couple would not make sense.

                          With radio buttons, you could simply use:

                          If ( checkboxfield = "single" ; 60 ; 50 )

                          or use the looked up value method I previously mentioned to copy these values in from another table so that if you want to change the values in the future you can do so more easily than you can with this method.

                          If you really want check boxes, you can use this method:

                          Case ( Not IsEmpty ( FilterValues ( CheckboxField ; "Single" ) ) ; 60 ; 
                                      Not IsEmpty ( FilterValues ( CheckboxField ; "Couple" ) ) ; 50 ;
                                      "")

                          To count the number of selected boxes in a field, you can put this in a calculation field: ValueCount ( YourfieldnameHere )

                          • 10. Re: Checkbox help
                            TylerRains

                            both of those options, no matter which I selected displayed 50

                            • 11. Re: Checkbox help
                              philmodjunk

                              We're missing some key detail. Are both fields defined in the same table?

                              Here's a demo file you can download and compare to yours to see if you can spot anything:  http://www.4shared.com/file/5kF1lqT8/CheckBoxEnumeration.html

                              • 12. Re: Checkbox help
                                TylerRains

                                i cant seem to see where the diconnect is.

                                here is mine so you can see if you can find anything

                                http://www.4shared.com/file/xKyQeI6A/LIR.html

                                • 13. Re: Checkbox help
                                  philmodjunk

                                  Your file is locked with an account name and password.

                                  • 14. Re: Checkbox help
                                    TylerRains
                                    ok after playing with it for several hours I got it to do what I want. One further question, is it possible for the people who selected certain boxes (i.e. the list of 12 that we counted) to go onto a list on a separate layout?
                                    1 2 Previous Next