Jump to content
Sign in to follow this  
servebot

Combined AND / OR searches

Recommended Posts

I'm having trouble scripting a combination AND OR search using FileMaker7.

For example: A search for all records where Parameter_1 is A or B or C, AND where Parameter_2 is 1 or 2 or 3. Done correctly, this should find those records matching all nine permuations of the search criteria (A1, A2, A3, B1, B2, B3, C1, C2, C3).

Hope this makes sense. Any advice?

Thanks for your help,

Michael

Share this post


Link to post
Share on other sites

Do a perform find script step for the first set of OR's then follow that by a contstrain found set step for the second set of OR's. For the OR's use the add new request for each OR required. Rather than scripting by keyboard perform the first find using the proper layout in find mode, then go into the script select the perform find step and the parameters you just used should show up in the menu. Do the same for the contrain step.

Rod

Share this post


Link to post
Share on other sites

ANDs use the same request, ORs use new request. Thus you will need 9 requests. Your script will look something like this:

Enter Find Mode []

Set field [1, "A"]

Set field [2, "1"]

New request

Set field [1, "A"]

Set field [2, "2"]

New request

Set field [1, "A"]

Set field [2, "3"]

New request

Set field [1, "B"]

Set field [2, "1"]

New request

Set field [1, "B"]

Set field [2, "2"]

New request

Set field [1, "B"]

Set field [2, "3"]

New request

Set field [1, "C"]

Set field [2, "1"]

New request

Set field [1, "C"]

Set field [2, "2"]

New request

Set field [1, "C"]

Set field [2, "3"]

Perform Find []

Share this post


Link to post
Share on other sites

You can use Duplicate Record/Request to streamline it.

Enter Find Mode [ ]

Set Field [1, "A"]

Set field [2, "1"]

Duplicate Record/Request

Set field [2, "2"]

Duplicate Record/Request

Set field [2, "3"]

Duplicate Record/Request

Set field [1, "B"]

Duplicate Record/Request

Set field [2, "2"]

Duplicate Record/Request

Set field [2, "1"]

Duplicate Record/Request

Set field [1, "C"]

Duplicate Record/Request

Set field [2, "2"]

Duplicate Record/Request

Set field [2, "3"]

Perform Find [ ]

Share this post


Link to post
Share on other sites

Ralph's method works, but I need something more flexible, since users will be entering their own combinations of values.

Rod's method works perfectly, but I need to automate this with a script. Is there a way to perform or simulate "add new request" in a script?

---------------

Thanks,

Michael

Share this post


Link to post
Share on other sites

You can have the search done in Browse Mode using globals. Then use the script steps above, substituting your global field names for A, B, C, 1, 2, 3 (and don't use quotes).

New Record/Request is the step you seek.

Share this post


Link to post
Share on other sites

The script works! The "New Record/Request" step was exactly what I needed to make this work. Thanks everyone.

-----------

Michael

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.