6 Replies Latest reply on Jul 22, 2013 4:47 AM by Tusquittee

    Checkbox Calculation Script



      Checkbox Calculation Script



      Hello everyone.  I’m not sure how to explain what I’m looking for.  I've been searching the posts, but feel like I’m searching for all the wrong terms.


      Students progress through a program taking multiple courses over a period of time.  They register for a specific class offering of a specific course and then return the next session to take more classes.  I have a checkbox field containing each of the courses they need to take before graduation.  Is it possible to write a script to find each instance of where they were registered for the class AND received a passing grade.. and then use that information to check a box in the completed course field so we would be able to track their progress?


      I’d like to run the script at the end of each session... which would update the student records with the classes they just took and passed.  


      I think I need to set the checkbox field up as a calculation so that every time a specific class = one of the choices from the textbox it would become checked...but, not sure what that would look like...how do i write a calculation to determine if the class they were in matches with one of the possible variables in the value list that creates the checkbox field....


      Thanks for any advice.. or even if you just have another post I should read first..

        • 1. Re: Checkbox Calculation Script

               i tried a specific class thinking if i could get it to work for one i could later add in the other classes and grade status....

               Reg Data is the tbl that has all the registration information.. So, go to Reg Data.. Search for a particular class.....if that class is found then go to the student detail layout and set the checkbox field (transcript) to check the box which says NT 604..... 


          Go to Layout [ “Reg Data” (Reg Data) ]
               Enter Find Mode [ ]
               Set Field [ Reg Data::Number|Name; "NT 604-Revelation" ]

          Set Error Capture [ On ]
               Perform Find [ ]
               Go to Layout [ “Student Detail” (Students) ]
               Set Field [ Students::Transcript; "NT 604" ]

               but this doesn't work either... any thoughts?
          • 2. Re: Checkbox Calculation Script

                 Database Structure?

                 Students Table


                 StudentClass Table - A join table linked to Students and Classes - a table to create reports including data from both main tables

                 Some databases have multiple join tables specifically to make it easy to generate reports.

                 Google "join talbles class student site:forums.filemaker.com"


            • 3. Re: Checkbox Calculation Script

                   thanks David.. I feel like  the underlying data structure is correct... I understand join tables... What I'm having difficulty with is how to refer to a specific part of the value list for a checkbox field.... if you have a checkbox which uses a value list.. how do I refer to a specific value in that checkbox?

              • 4. Re: Checkbox Calculation Script

                     Put another way... Suppose you have a checkbox field which uses these values:  red, blue, green, orange.... and elsewhere I've sold a customer two objects.. one is red, one is orange.  I would like to write a script that would look at the history of all items sold and then make the red and orange checkboxes active.

                     I think filemaker stores the multiple values as separate line items... how do i say something like.. turn on the red and orange checkboxes but don't turn on the blue and green... how do I write a calculation to refer to that specific piece of the value list?

                     I'm sorry if I'm not explaining this very well.. I'm still a newbie.. 

                • 5. Re: Checkbox Calculation Script

                       I don't think a single field formatted with a check box format is the best option for you. Pulling up a found set of records listing the same data you want to show in your check box formatted field would seem a simpler more straight forward way to go. Exactly how you would implement that depends on your data model.

                       That said...

                       To use a script to select a value in a check box field without overwriting previously selected values:

                       Set Field [ Yourtable::YourCheckBoxField ; List ( YourTable::YourCheckBoxField ; NewValueToSelectGoesHere ) ]

                       To test to see if a particular value in a checkbox field has been selected:

                       Not IsEmpty ( FIltervalues ( YourTable::YourCheckBoxField ; ValueYouAreCheckingForHere ) )

                       will evaluate as true if ValueYouAreCheckingForHere has been selected in the checkbox formatted field.

                  • 6. Re: Checkbox Calculation Script

                    Thanks Phil... After more thought you're right.. a simple portal will display the data I want... and I appreciate the script help too... The List function was what I was confused about.. It's helpful to know that this is possible even if I don't need it right now.. Thanks again.