Query Conditions

Version 2

    Problem:

    When running a newly designed query (in v7.2.6 or earlier), you may get unexpected query results that do

    not seem to match the query conditions you specified.

     

    This is because Query Designer in v7.2.6 (and earlier) does not allow for specifying bracketed query conditions.

     

    According to standard precedence rules, AND takes precedence over OR.

    So something like:
    Status is Resolved OR Status is Closed AND Category = Hardware
    Will get evaluated as:
    Status is Resolved OR (Status is Closed AND Category = Hardware)

    Meaning that you get ALL resolved calls as well as all closed Hardware calls.

     

    Solution:

     

    A workaround in v7.2.6 (and earlier) is to repeat the AND conditions after an OR statement.  So in our example:

     

    Status is Resolved

    AND Category = Hardware

    OR Status is Closed

    AND Category = Hardware


    This will be improved with the release of v7.3 and will allow you to specify your own placement of brackets. Please see the What's New Guide for 7.3 under To add complex criteria to a query

     

    Examples:
    The following examples demonstrate the difference that the brackets and order of
    the criteria make.
    (1 AND 2) OR (3 AND 4)
    To be included in the results, a record must meet:
    either
    both of the criteria 1 and 2
    or
    both of the criteria 3 and 4