Creating Boolean Formulas

Objective

After completing this lesson, you will be able to display True/False result using Boolean formula.

Boolean Overview

You can use Boolean to check conditions within a field. For example, to determine whether an order amount matches a certain condition, you would write a formula like this: {Orders.Order Amount} > 5000

A Boolean formula always returns a value of True or False. The result of a Boolean formula can be displayed as:

  • True or False
  • T or F
  • Yes or No
  • 1 or 0

You can change how a Boolean value displays in your report by right clicking the value and selecting the Format option. You then have the option to display it as 1 or 0, Y or N, Yes or No, True or False, or T or F.

Watch this video to see how to use a boolean formula.

Creating a Boolean Formula

Boolean operators are used to create conditions that require a logical relationship between two or more values. Conditions that use Boolean operators are called Boolean expressions.

  • A and B means that both A and B must be true for the condition to be satisfied (to return a True value).

  • A or B means that either A or B (or both) must be true for the condition to be satisfied (to return a True value).

Examples of Boolean Operators

Several useful examples of Boolean operators include the following:

  • And

  • Or

  • Not

The AND Operator

The And operator joins the value of x and y. The And operator takes two expressions that evaluate to a Boolean. The expression evaluates True only if both x and y are true. All other combinations result in a value of False.

Value of xValue of yx and y
TrueTrueTrue
TrueFalseFalse
FalseTrueFalse
FalseFalseFalse
AND Operator examples

The OR Operator

The Or operator takes two expressions that evaluate to a Boolean. If either expression evaluates True, the operator returns True. If both expressions evaluate False, the operator returns False.

Value of xValue of yx and y
TrueTrueTrue
TrueFalseTrue
FalseTrueTrue
FalseFalseFalse
A compact instructional table with a blue header labeled Code, Example, and Description shows four rows of boolean-or expressions and concrete evaluations—row 1: A > B or B > C illustrated by 10 > 6 or 6 > 3 with the note True, where A = 10, B = 6, C = 3 (Both conditions are true); row 2: same code with 10 > 6 or 6 > 7 noted True, where A = 10, B = 6, C = 7 (Either one of the two conditions is true); row 3: same code with 5 > 6 or 6 > 7 noted False, where A = 5, B = 6, C = 7 (Neither of the two conditions is true); and row 4: (A > B) or (A * C - D > E) or (E / D <= B) illustrated by (5 > 6) or (5 * 3 - 2 > 12) or (12 / 2 <= 6) with the note True, where A = 5, B = 6, C = 3, D = 2, E = 12 (At least one of the three conditions is true; in this case only (A * C - D > E) is true), arranged in alternating light-gray cells for clear, concise explanation of OR logic.

The NOT Operator

The NOT operator reverses the True or False value of x.

Value of xNot x
TrueFalse
FalseTrue
A blue‑headed, three‑column table labeled Code / Example / Description presents two instructional rows that illustrate the Boolean expression not (A > B and B > C) with concrete numeric examples—not (5 > 4 and 4 > 3) and not (3 > 4 and 4 > 3)—and step‑by‑step descriptions explaining that in the first case both comparisons are true so the And expression is True and the Not operator makes it False, while in the second case one comparison is false so the And expression is False and the Not operator makes it True.

Summary

  • Boolean formulas assess conditions within a field and produce a result of either True or False, which can be displayed as Yes/No or 1/0.
  • The display format for Boolean results can be altered by right-clicking and selecting the Format option.
  • Boolean operators—including And, Or, and Not—determine the logical connections between values: And necessitates that both conditions are true, Or requires at least one condition to be true, and Not reverses the result.

Log in to track your progress & complete quizzes