1 2 Previous Next 18 Replies Latest reply on Jun 10, 2011 2:00 PM by aammondd

    Auto Check a Check box In a List

    ZoocMan85

      Title

      Auto Check a Check box In a List

      Post

      Hey Everyone,

         I read here on the forums about auto checking a check box however, my situation is a little different. On my one layout i have a question that is a yes or no. The question is do you own a car. Yes Or No. What i want to happen is if you select Yes. I want it to auto check a check box on the next screen where you schedule your appointment and a selection of check boxes for documentation they need to bring in. However i want the check box in the list that says vehicle registration to be auto checked if you own a vehicle= yes. The list is auto generated form a table called documentation. I then related that to the yes or no question on the other layout. What do i need to do to make this work?

       

      Ray Z

       

      custom.jpg

        • 1. Re: Auto Check a Check box In a List
          philmodjunk

          "I want it to auto check a check box on the next screen"

          Doesn't tell us enough about how you've set this up. You have layout #1 where your user clicks the first check box (I recommend a radio button here.) Then you have Layout #2 where you want to show another selection to be made automatically. We need to know about the tables that each layout refers to and how they are related. We also need to know what else is to happen here. Should this action first create a new record on the second layout before entering the specified value?

          • 2. Re: Auto Check a Check box In a List
            ZoocMan85

            Here is the setup...

            Layout #1 (Application Table)

            Do you own a car. = (Drop Down Menu) = YES OR NO  This field name is   _FKDocumentationCheck

             

            Layout #2 (Application Table) =  Lists of documentation populated in checkboxes from the table (Documentation.)

            Screen Shot shows how they are related.

            Trying to accomplish:

            If User answers yes to ...do you own a car... Then auto check from the populated list on layout 2 that uses a value list from the table Documentation... to autocheck bring Vehicle Registration.

            • 3. Re: Auto Check a Check box In a List
              philmodjunk

              Is the second item to be selected a field in Documentation or Pre Screen App Main? (don't see any fields in Documentation that you can use for this purpose in your screen shot.)

              • 4. Re: Auto Check a Check box In a List
                ZoocMan85

                Both layouts Phil use the same table. They use Pre Screen Application Main. However i have a separate table which is documentation which is in a value list on the 2nd layout that is autopopulated by the documentation table.

                • 5. Re: Auto Check a Check box In a List
                  ZoocMan85

                  The 2nd item to be selected is in the documentation table.

                  • 6. Re: Auto Check a Check box In a List
                    ZoocMan85

                    __PKType of Doc ... from documentation table is related to Pre Screen App Main  _FKDocumentationCheck .

                    • 7. Re: Auto Check a Check box In a List
                      philmodjunk

                      In which case, you wouldn't seem to need the relationship if it's just to supply a value list for your check box formatted field in the other table.

                      Ok, that sets up something that can be handled by an auto-enter calculation.

                      On your second checkbox formatted field, add this auto-entered calculation:

                      If ( valueCount ( FilterValues ( Self ; "Vehicle Registration" ) ) Or ( DoYouOwnacarField = "No" ) ; Self ; List ( self ; "Vehicle Registration" ) )

                      Then clear the "do not replace existing values..." option.

                      • 8. Re: Auto Check a Check box In a List
                        ZoocMan85

                        Phil that works however if i go back and then change the question to NO i dont have a car... The check box on bring in vehicle registration is still checked. Also if you create a new record and select NO to i dont have a car...Bring in Vehicle registration is still checked.

                        Only way to take it off is to manually uncheck it... However you cant manually uncheck it if you answered YES to do you own a car. Which is great but i need it to not automatically check if the answer is no.

                        • 9. Re: Auto Check a Check box In a List
                          philmodjunk

                          Unfortunately, you can't "uncheck" a selection in a checkbox group with an auto-entered calculation, unless you use FileMaker advanced to add a custom function to your file.

                          To "uncheck" that option when the field is changed back to "No", you'd need to use a script trigger to run a looping script to find and delete that value from the list of values stored in that field.

                          • 10. Re: Auto Check a Check box In a List
                            ZoocMan85

                            I have Filemaker advanced however, what do you think is the easiest to fix this?

                            • 11. Re: Auto Check a Check box In a List
                              philmodjunk

                              You can use Manage Custom Functions to start a new custom function. Copy and paste this function definition into the function editor:

                              //  RemoveSubList ( SourceList ; SubList )
                              //
                              // Return a list of all values in SourceList that are not also listed in SubList
                              // SourceList: A return separated list of values
                              // SubList: a Return separated list of values to be removed from SourceList

                               Let ( [ ListItem = GetValue ( SubList ; 1 ) ;
                                         SubListRemanent = RightValues ( SubList ; ValueCount ( SubList ) - 1 ) ;
                                         FilteredSourceLista = Substitute ( ¶ & SourceList & ¶ ; ¶ & ListItem & ¶ ; ¶ ) ;
                                         FilteredSourceListB = Middle ( FilteredSourceLista ; 2 ; Length ( FilteredSourceLista ) -2 )
                                        ] ;
                                      Case ( IsEmpty ( SubList ) ; SourceList ;
                                                 RemoveSubList ( FilteredSourceListB ; SubListRemanent )
                                               ) // case
                                       ) // Let

                              Make sure that the function is named SourceList and to add the parameters SourceList and SubList.

                              Now we can modify our auto-enter calculation as:

                              Case ( DoYouOwnacarField = "No" Or IsEmpty ( DoYouOwnacarField ) ; RemoveSubList ( self ; "Vehicle Registration" ) ;
                                        valueCount ( FilterValues ( Self ; "Vehicle Registration" ) ) ; Self ;
                                        List ( self ; "Vehicle Registration" )
                                       )

                              • 12. Re: Auto Check a Check box In a List
                                ZoocMan85

                                It wont let me add the parameter SourceList... Says its already in use.

                                • 13. Re: Auto Check a Check box In a List
                                  philmodjunk

                                  Hmmm, wonder if you need to add the parameters, then paste the function definition.

                                  • 14. Re: Auto Check a Check box In a List
                                    ZoocMan85

                                    It seems you cant name the function the same as a parameter.

                                    1 2 Previous Next