Searching on Checkboxes

Version 1

    Hi All, I'm pretty new to FMP and I've been using Bento and loving it as long as it worked. But as you know, it's been discontinued and the latest version of the Mac IOS really killed the app forever.

     

    So I used the migration tool and got all of my data from Bento over to FMP.

     

    I've learned how to create a script and I'm using for automated searches.

     

    I want to search on some checkbox items and I can't figure this out. "Show all of the entries that have a certain checkbox checked".

     

    thanks if you can help, best, Peter

     

    Without going into any possible caveats, in the simplest form you

     

    • enter find mode (press cmd/ctrl-F, select the command from the View menu …)

    • check the desired value in the checkbox

    • press return (or click the Perform Find icon the toolbar)

     

    Where this can get complicated is when you have a field with multiple check boxes. If you enter mind mode and select more than one, what result do you want?

     

    Your script can find only the records that have all the selected values or you can set up a script that finds records with any one of those values.

     

    Hi and many thanks for this!

     

    Sorry to be slow in getting back. Turns out I had a month of studio work and had to leave the database learning aside. But I'm back and have around 4 things I need to work out.

     

    Your directions work and thanks for this.

     

    I'm still hoping to create a script that can do a search on a checkbox.

     

    I can include a version of my database file that is slimmed down to 2 entries and it would demonstrate the issue.

     

    Any ideas?

     

    all best, Peter

     

    Hi and many thanks for this!

     

    Sorry to be slow in getting back. Turns out I had a month of studio work and had to leave the database learning aside. But I'm back and have around 4 things I need to work out.

     

    I'm still hoping to create a script that can do a search on a checkbox.

     

    You wrote:

    "Your script can find only the records that have all the selected values or you can set up a script that finds records with any one of those values."

     

    And what I'd like is the first option, only the records that have ALL of the selected values.

     

    I can include a version of my database file that is slimmed down to 2 entries and it would demonstrate the issue.

     

    Any ideas?

     

    thanks for the help, best, Peter

     

    Most script steps have a corresponding menu option and this is the case here:

     

    enter find mode (press cmd/ctrl-F, select the command from the View menu …)

    Script step: Enter Find Mode [ ] --Clear the "pause" check box

     

    check the desired value in the checkbox

    Script Step: Set Field [YourTable::YourCheckboxFieldHere ; "Value of check box option here" ]

     

    press return (or click the Perform Find icon the toolbar)

    Script Step: Perform Find [ ]

     

    To that, I'd normally add more to more gracefully handle cases where no record has the specific check box value selected to produce a script like this:

     

    Enter Find Mode [ ]

    Script Step: Set Field [YourTable::YourCheckboxFieldHere ; "Value of check box option here" ]

    Set Error Capture [on] --> This step keeps the "no records found" dialog from interrupting your script

    Script Step: Perform Find [ ]

    If [ Get ( FoundCount ) = 0 // no records were found ]

      Show Custom Dialog ["No records matching this criteria were found" ]

    End If

     

    If interested, you can examine this thread of scripted find examples for more on how you might script a find in FileMaker.

     

    Thanks but look below where I’m confused:

     

     

     

    Peter Sprague

    311 East Glaucus St.

    Encinitas, CA 92024

    760-436-3906

    www.petersprague.com <http://www.petersprague.com/>

     

    In the suggested script, you do not use that dialog at all. Just close it. Instead of storing criteria inside the Perform Find or enter Find mode steps, the set field is setting up the criteria for you. In this particular case, no operator is actually needed unless you have several different check box values that are similar. In that case, you can modify the set field step to include a find operator such as:

     

    Set Field [YourTable::YourCheckboxFieldHere ; "==Value of check box option here" ]

     

    And in my last post, I got into a bit of a rush and didn't notice that I pasted some text that shouldn't be there. The "Script step:" text should not be in the final script example.

     

    Thanks Phil on this but I’m still doing something wrong.

     

    Step one is good.

     

    Step two looks like this:

     

     

     

    and then step three (perform find) looks right.

     

    But when I run the script it doesn’t work…

     

    thanks, Peter

     

     

     

    Peter Sprague

    311 East Glaucus St.

    Encinitas, CA 92024

    760-436-3906

    www.petersprague.com <http://www.petersprague.com/>

     

    You need to click the gear icon and then enter your search criteria expression as a "calculated result".

     

    in the next line, that's the text shown in red:

     

    Set Field [YourTable::YourCheckboxFieldHere ; "==Value of check box option here" ]

     

    We’re getting closer,,,,sorry about being such a beginner. Look below…

     

     

     

    Peter Sprague

    311 East Glaucus St.

    Encinitas, CA 92024

    760-436-3906

    www.petersprague.com <http://www.petersprague.com/>

     

    Why not use the picture icon in the tool bar to insert screen shots directly into your posts?

     

    And you aren't close here. You are in the wrong dialog. Do not click "specify" from the specify field dialog. You have to go back to the script step, click the gear icon and then select the calculated result option to open the calculation editor.

     

    Sorry for not sending the image along correctly. I've been responding to your posts via email versus here on he browser and as a result I guess the images haven't been coming across correctly.

     

    OK, I'm back to the script step, no click on specify, click on the gear icon and then calculated result leading to the calculation editor.

     

    I click on Peter solo and then this correct:

    SpecifyCalc.jpg

     

    How do I then enter this info: "==Value of check box option here" ]

     

    thanks, Peter

     

    This document was generated from the following discussion: Searching on Checkboxes