Introduction to Boolean Operators


Prerequisite: You should already understand If-Then Statements.

Boolean Operators are the most important operators to use with If-Then statements. These operators extend the power, precision and flexibility of If-Then statements considerably. They can also save you time and space in your variables.

This guide will cover the following topics:

  • AND
  • OR
  • NOT
  • Combining ANDs, ORs and NOTs

Note: The above operators are presented in all capital letters to reduce confusion with their normal, every-day, natural-language counterparts. InfoView can understand all variants, but defaults to a capitalized first letter and lower-case other letters.


ANDs, ORs and NOTs

As operators, AND, OR and NOT don't do anything by themselves. Instead, they must be applied to one or more things (text, database objects and functions) to help define a more specific formula.


Diagram showing boolean and

A Boolean AND returns only those results that satisfy both conditions at the same time.

Syntax: If condition_one AND condition_two (are both true) Then do_this

Example: =If [D Dept Code]="AMST" And [CS Course]="100" Then "My Class"

This variable states that in the situation where the department code is equal to "AMST" while at the same time the course code is "100", then it should display "My Class".

Screenshot of InfoView showing variable using AND


Diagram showing boolean or

A Boolean OR states that all results need only satisfy one of the two conditions in order to pass on to the action defined after "Then".

Syntax: If condition_one OR condition_two Then do_this

Example: =If [CS Course]="102B" Or [CS Course]="100" Then "My Classes"

This variable states that classes that have either Course Code "102B" or Course Code "100" should display "My Classes"

InfoView Screenshot showing variable using an OR

Note: In this variable, we have not defined if the Department Code should be "AMST"; All classes, regardless of department that have either of those numbers will show "My Classes". To prevent this sort of mix-up, check out the Parentheses Guide.

Screenshot of InfoView variable using OR


Diagram showing boolean not

A Boolean NOT states that all results returned will not satisfy the condition defined.

Syntax: If NOT(condition_one) Then do_this

Example: =If Not([D Dept Code]="AMST") Then "Not My Classes"

This variable states that all classes that are not coded with Department Code "AMST" will show the text "Not My Classes"

InfoView Screenshot showing varaible using NOT

Combining ANDs, ORs and NOTs

ANDs, ORs and NOTs are infinitely combinable with each other. Exactly how they execute can be tightly controlled with parentheses. If you do not use parentheses, the variable will execute left-to-right, which might not be what you mean.

For more information check out the Parentheses Guide, especially the section under Logic.