Link to home
Start Free TrialLog in
Avatar of MarkJulie
MarkJulieFlag for United States of America

asked on

FIND logical order for multiple AND/OR criteria

I need to query my db for several items. I regularly use Constrain, Extend, and Omit in isolated cases, but I need help with the order and syntax to combine AND/OR for complex searches.
Query:
Procedure A or B [ProcA OR ProcB] (from two different fields that either have a date or are NULL)
AND Location [MyTown] (from a checkbox list of locations)
AND Time 1/1/2010...12/31/2010 (from a date field)
AND [1 OR 3] from {1,2,3,4,5} (from a radio button field where I really want NOT [2 OR 4 OR 5]).

Thanks,

Mark
Avatar of Will Loving
Will Loving
Flag of United States of America image

Hi Mark - It sounds like this will involve several similar Find requests or Find followed by a Constrain. The general rule with the order of Find Requests, is to always Find what you want first and then use Omit or Constrain afterwards. (I use Extend sometimes, but very rarely compared to Omit or Constrain). There are probably many ways to get what you want but here's one possible order based on what you've described:

First Find request (FIND):

Procedure A [ProcA ] (from two different fields that either have a date or are NULL)
AND Location [MyTown] (from a checkbox list of locations)
AND Time 1/1/2010...12/31/2010 (from a date field)

Second Find request (FIND):

Procedure B [ProcB ] (from two different fields that either have a date or are NULL)
AND Location [MyTown] (from a checkbox list of locations)
AND Time 1/1/2010...12/31/2010 (from a date field)

Third Find request (OMIT):

[2] from {1,2,3,4,5} (from a radio button field

Fourth Find request (OMIT):

[4] from {1,2,3,4,5} (from a radio button field

Fifith Find request (OMIT):

[5] from {1,2,3,4,5} (from a radio button field

Requests 3-5 could also be done as a Constrain after the initial find, either Omitting 2, 4, and 5 or Finding the two you want, 1 and 3.
Avatar of MarkJulie

ASKER

Willmcn,

I tried the steps you suggested, but I am misusing the results of the two Find requests. I get 67 records when I set criteria for the first Find, Duplicate Request and change from ProcA=* to ProcB=* leaving the date range 1/1/2010...12/31/2010 and Location = MyTown in both requests.

After setting criteria for each Request, I run Find and get 67 records.

At this point, I run Modify Last Find (emptying Date, Procedure, and Location criteria) changing to Omit=2 from list {1,2,3,4,5} and Constrain Found Set.

Instead of getting <=67 records, I get 5009.

What do I need to do differently?

For further clarification, does adding additional requests accumulate into one large OR Find?

What is the difference between Add New Request and Extend Found Set for my situation?

This may take several rounds. Apologies for being offline several days of the week and slow response on my end.
Don't use Modify Last Find, but do Constrain Found Set [] including the two Omit Find Requests. this keeps your find within the found set. (I have to go out for a bit but will respond more fully when I return).
I got a partial solution, but I await your further comments.
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the additional teaching to save noob questions in the future for me and others.