6 Replies Latest reply on Jun 7, 2012 2:25 PM by philmodjunk

    Sub-checkboxes?

    CANWizard

      Title

      Sub-checkboxes?

      Post

      Hi all,

      I have a contact database and I want to make it easier to sort so I have developed a list of categories a customer can fall under using a checkbox system.  Is it possible to have a "main" checkbox and then have "sub" checkboxes underneath that?  For instance, a Donor Category checkbox would have "Individual" and "Foundation" underneath it.  I want it so that for instance if "Individual" is checked, the "Donor" is checked too.

       

      How can I achieve this?  Thanks.

       

        • 1. Re: Sub-checkboxes?
          philmodjunk

          A script controlled by an OnObjectMOdify trigger can keep your check boxes in synch.

          And a conditional value list can control what values appear in one check box broup as a result of which value is selected in another.

          • 2. Re: Sub-checkboxes?
            CANWizard

            Could you elaborate more on this?  Where could I input the script in?  Would it need to be called everytime to make sure or can it be constantly running in the background?

            • 3. Re: Sub-checkboxes?
              philmodjunk

              Can you elaborate on what you need in more detail?

              So far I know this

              Field 1:

              [] Donor

              Field2:

              [] Individual
              [] Foundation

              clicking Individual should also select Donor.

              But I can't help thinking there's more to what you want here...

              What I'm describing with the script trigger is this:

              #This test checks to see if Individual is clicked. It will return true even if Foundation and Individual are both selected.
              If [ ValueCount ( Filtervalues ( YourTable::field2 ; "Individual" ) ) ]
                 Set Field [YourTable::Field1 ; "Donor" )]
              End If

              Right Click Field2 while in layout mode and select "Script triggers". Select the OnObjectModify trigger. Specify the above script as what should run when the value of Field2 changes.

              But note that this script makes assumptions that may not match what you intend to do. It assumes a single value check box for Field1. If there are other values in the value list for field 1, a more sophisticated expression will be needed to keep other selected values from disappearing when a user clicks "Individual". And it assumes that both Foundation and Individual can be selected for the same record. If only one or the other may be selected, I recommend using a radio button format instead of check boxes.

              • 4. Re: Sub-checkboxes?
                CANWizard

                What if I have the checkbox set all in one field, "Contact Type"?

                 

                Like:

                Field 1:

                [] Donor

                Field 1:

                [] Individual
                [] Foundation

                 

                When I apply the script trigger to it, and try to check Individual, it will uncheck Individual and check Donor.

                I am not working with 2 fields, but should I for this situation?

                I tried to tweak the code you sent me by adding

                Set Field [YourTable::Field1 ; "Donor" and "Individual Donor" )]

                But filemaker didnt seem to like that.

                • 5. Re: Sub-checkboxes?
                  CANWizard

                  Never mind, I fixed it.  I needed to add a newline ¶ character so it looked like "Donor¶Individual Donor"

                  • 6. Re: Sub-checkboxes?
                    philmodjunk

                    You can also use the list function:

                    List ( "Donor" ; "individual donor" )

                    But from what little you've posted, I don't see any real advantage and a small possibility for confusion if you use a single field instead of separate fields.