2 Replies Latest reply on Mar 7, 2009 9:43 AM by ninja

    Searching using criteria from a related table in non-global fields

    asprings

      Title

      Searching using criteria from a related table in non-global fields

      Post

      I a database that's allowing me to perform relatively complex searches on a large dataset. I'm currently accomplishing this by entering the search criteria into global fields in a separate "search fields" table, then running a set of search scripts that enter find mode, set the various fields to the values in the global fields, and perform a search or searches. For a very simple example, if I want to search for all person records with a city of Boston, I'd enter "Boston" in the Search Fields::City global fields, and my search scripts will go to the right layout, enter find mode, set the "City" field to "Boston", and perform a search. The real searches are more complicated, usually involving multiple scripts and contstraining/extending found sets.

       

      This is working great with global search fields. The problem is that this database will eventually be shared on a filemaker server, and potentially have reasonably heavy use, so I'm afraid that either a) users will overwrite search fields, causing an issue, or b) the search field records will lock, causing users not to be able to perform searches. 

       

      I had planned on solving this issue by backing away from having the search fields as global, instead creating a new record for each user on file open, then deleting it on close, and always taking search criteria from the user's own record. However, I can't seem to make my search scripts work with non-global fields. The tables are related, but it can't seem to grab the current data from the search field. 

       

      Is it even possible to do this using a non-global field? Any suggestions on how to handle this issue, either using non-global fields, or via some other method entirely? Thanks in advance!

        • 1. Re: Searching using criteria from a related table in non-global fields
          deltatango
            

          Global fields are unique to a user's session when in multi-user mode so a user could not overwrite another user's data or lock a record. This would only occur if the fields were not global. 

           

          Another thing to know about global fields is that whatever you last leave in them in single user mode will be what the fields default to in multi-user mode. Don't ever rely on global fields to store data.

           

          Always have a start up script that sets these or at least one that checks that they have the proper values before running or else you could wind up with a lot of headache. 

          • 2. Re: Searching using criteria from a related table in non-global fields
            ninja
              

            Seconding deltatango's post above and tying it to your described app,

             

            Don't worry about users overwriting if the fields are global...for what you describe, you would WANT them to be globals.

             

            In your described use, you would want the fields empty to start.  So list the global search fields in your startup script and empty them:

             

            Setfield (SearchTable::City;"" )

            Setfield (SearchTable::Zip;"" )

            Setfield (SearchTable::whatever;"" )

            and so forth.

             

            Have a great weekend!