And/Or Logic in Reports

Suppose you go to a nightclub where the doorman's job is to enforce a simple rule: "Everyone (ALL) in your group must wear a tie to come in". You go along with a friend one night. If you're both wearing ties, you'll get in. If only one of you is wearing a tie, or if neither of you is, neither of you will get in.

You're not wearing a tie, so you go to another club further down the street. Here, the person on the door is enforcing a different rule: "A group of people can come in if some of them (ANY) is a member". If either you or your friend is a member, or if you both are members, you can both come in. If neither of you is a member, you're both left out in the cold.

Suppose you run a report in GAL and you want to get a list of ALL of the contacts in the East Organization. You scope the report to only look at the East Organization. Select the fields you want to look at and run the report. However, if you wanted to see ALL of the records in East Organization that have “m” in their name AND that work in the Accounting Department you would filter the records this way:

But suppose you wanted to see a list of contacts whose last name started with “s”. You would filter the contacts you want to see by selecting ANY records where last name starts with “s”. Now you want to see all contact in East Organization whose last name starts with “S” OR whose first name starts with “t”. You still are looking at only some of the records. You would filter the records by adding two ANY statements:

In GAL, our report builder uses the ALL (AND) and ANY (OR) operators to combine multiple conditions to narrow data for your report.

These operators provide a means to make multiple comparisons with different fields. For example, here is how we use AND when building a report listing all of the plans. This would create a report showing ALL of the PLANs that are not part of the “East” Organization AND have an Interruption Level of “Major”.

You can combine as many number of conditions using the ALL (AND) operator but all of the conditions must be TRUE in order for the report to list any plans. 

Let’s compare this with the ANY (OR) operator in our report builder. You can combine as many number of conditions using the ANY operator but only one of the conditions must be TRUE for the report to run.

What records will be on this report? Be careful this is a tricky question. Do you think if a PLAN that is part of the “East” Organization with an Interruption Level of “Major” would be included on the report? It would. ANY record that satisfies ANY of the conditions would end up in our report. The ANY operator displays a record if either the first condition OR the second condition is true.

Let’s try this:

I would end up with a report that only included PLANs with “Major” Interruption Level AND that did not belong to “East” Organization. The first operation gives me ALL PLANs with “Major”. The second operation looks at those records AND gives me only PLANS that do not belong to “East”.

Let’s go back to our nightclub. What if we saw this sign posted on the door? Who gets in?