Flexible criteriaANDORUse bracketsNegate the termThese flexible criteria options are part of the Database Loop window.

The LOOP command supports flexible criteria. The above options are not all available to use at the same time because it depends upon what criteria is selected and the context.

To learn more about the features of this window, glance down the table below or highlight the control you are interested in by clicking on the screenshot above.


AND

When two or more criteria are used for WHERE or IF, by default both criteria must be TRUE to proceed. This is also accomplished by selecting AND when you have the second criteria selected.

Flexible criteria - AND

Note IconYou can chain multiple criteria together with AND, or a mixture of AND / OR.


OR

When two or more criteria are used for WHERE or IF, by default both criteria must be TRUE to proceed. If you want to proceed if either criteria are TRUE, this is accomplished by selecting OR when you have the second criteria selected.

Flexible criteria - OR

Note IconYou can chain multiple criteria together with OR, or a mixture of AND / OR.


Use brackets

By default, in a mixed expression containing AND / OR, any criteria combined using OR will be evaluated first, and their result then used in AND combinations.

To give certain parts of the expression priority or simply to clarify the intended order of evaluation, you can select a pair of criteria and use brackets around them:

Flexible criteria - Use brackets

Note IconYou don't have to use brackets only around two consecutive criteria; you can select three or more criteria and use brackets. The brackets will be placed / removed around the first and last criteria selected.

It is strongly recommended that you use brackets when mixing AND / OR to clarify what you intended and to prevent unexpected results. For example:

(w OR x) AND (y OR z)


Negate the term

Sometimes it is more convenient to reverse the logic of a test result than to rearrange the test using different comparisons. This is accomplished by negating the term (a term is one criteria). Note that if brackets are present in front of a criteria, NOT will always appear outside.

Flexible criteria - Negate

It is possible by pasting script in directly to achieve (NOT x AND NOT y). This is perfectly legal, but cannot be accomplished using the window due to keeping it simple to use. If you need this exact expression, note that it is logically equivalent to NOT (x OR y), (note that AND has changed to OR) which is possible using the window.