3 Replies Latest reply on Apr 6, 2011 11:21 AM by philmodjunk

    Script to perform find in checkbox field

    macfilepro

      Title

      Script to perform find in checkbox field

      Post

      I need to have the user who's logged in (account name, I believe) have access to only those records that has that user's name in a checkbox field.

      The file in question is a rolodex file. The thinking is that there is one, master file. The checkbox field includes various user's names. So then any given record could be accessible by one or more people, but only if their name is checked. I'm not sure if this can be done with privilege sets, so I'm trying to get a script working that upon opening the file, finds only those records with: the current account name = name checked off in a checkbox field. If I do a manual find, it always works, and of course my found set is just what I would expect. Any scripting I have done always fails (no records match this find criteria). I have tried a script that is basic: Enter find mode, Set Field, Perform Find. I also tried a script that uses a variable ($) in a find request.

      I could be going about this the wrong way, so if anyone has some simple way to achieve my goal I'll be happy to say DUH! and I thank you very much.

        • 1. Re: Script to perform find in checkbox field
          philmodjunk

          Enter FInd mode[]
          Set field [YourTable::yourcheckboxfield ; Get ( AccountName ) ]
          Set Error Capture [on]
          Perform Find[]

          Should find all records where the current account name is selected in YourTable::yourcheckboxfield.

          You might want to use manage | Security... to control access to these records:

          Not Isempty ( Filtervalues (yourcheckboxfield ; Get ( AccountName ) ] could be used to set up record level access control:

          See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a detailed description of how to set this up.

          • 2. Re: Script to perform find in checkbox field
            macfilepro

            Thanks very much. That script is the one that I was using, and still there are issues with the existing rolodex file.

            BUT:

            I tried it on a new file and it works fine, so I suspect there are other things going on, maybe pre-existing privilege sets.

            At worst, I could rebuild the file from scratch, and keep testing the script as I add fields and make changes.

            I will visit "See "Editing record access privileges" in FileMaker Help and check out  this particular sub section: "Entering a formula for limiting access on a  record-by-record basis" for a detailed description of how to set this  up." That seems very appropriate for my needs.

            Again, thank you!

            • 3. Re: Script to perform find in checkbox field
              philmodjunk

              Check box formatted fields can "hide" data that doesn't match the current list of values. You might want to examine a copy of the field formatted as an edit box to check for that possibility.