When to use parentheses when building GoldMine filters

GoldMine filters allow you to segment contact records based on data in the record fields.  When creating a filter with multiple values in the same field in conjunction with other fields you need to use the  OR and AND boolean operaters.  It is important to understand how and when to use the parentheses when creating these more complicated filters.

Lets say you want to create a filter for the following conditions: Where the State is equal to New York or New Jersey and where the Sales Rep (KEY1) field is equal to JAY.

The following is a similar interpretation of the English phrase.

State=NY OR State=NJ AND KEY1=JAY

But something is wrong.  The problem is in the way the expression is read.  GoldMine sees the first Expression as all records where state=NY.  No problem.  The next part of the expression is, “All records where State=NJ and the KEY1=JAY.  This expression does contain just 2 conditions, but without brackets, where does one condition end and the next begin?  In this case the result that was delivered was ALL of  the contacts in NY, and only those contacts in NJ where JAY is the Sales Rep.

The reality is, without parentheses properly placed, the expressions are read on a first come, first served basis.  Brackets create an order within the filter.  Try this instead:

(State=’NY’ OR State=’NJ’) AND KEY1=’JAY’

With the brackets in place, the order of the expression is clearly defined.  There are just 2 conditions:  Records must be either from NY or NJ, and the Sales Rep field must be equal to JAY.

To create brackets in GoldMine’s filter builder, just click on the little left and right parentheses buttons where appropriate in the filter.  They should always start and finish any expression of one or more “OR” operators.