Operators

In a Console search query you must specify the name of the attribute you want to search on (for example, displayName) as well as the value that you want to search for (for example, Bob Jones). In addition to that, you must indicate the relationship between those two pieces of information; for example, do you want to know if the displayName equals Bob Jones or if the displayName does not equal Bob Jones? Specifying the nature of this relationship is the job of the operator.

The operators available in Console search queries are listed in the following table:

Operator

Description

=

Equal to. Returns all the user profiles where the attribute value is equal to the target value. Example: displayName = “Bob Jones”

!=

Not equal to. Returns all the user profiles where the attribute value is not equal to the target value. Example: displayName != “Bob Jones”

Greater than. Returns all the user profiles where the attribute value is greater than the target value. Example: created > “2017-09-25T07:59:59”

Less than. Returns all the user profiles where the attribute value is less than the target value. Example: created < “2017-09-25”

>=

Greater than or equal to. Returns all the user profiles where the attribute value is greater than or equal to the target value. Example: created >= “2017-09-25”

<=

Less than or equal to. Returns all the user profiles where the attribute value is less than or equal to the target value. Example: created <= “2017-09-25”

There’s nothing special about the search operators: with the possible exception of “not equal to” (!=) these are the same operators you learned back in your school days. However, there is one interesting way in which these operators differ slightly from what you learned way back when: you can use the greater than/less than operators (>, >=, <, <=) with string values as well as with numeric or date values. What does that mean? Well, suppose you have a list of users similar to this:

Let’s further suppose that you’d like to limit the displayed data to users who have an email address that begins with the letters H through Z. (In other words, you don’t want to see any users who have email addresses that begin with the letters A through G. And don’t worry about why you don’t want to display other email addresses. You just don’t.) This query will do exactly what you wanted:

email >= "h"

And here’s the proof:

We’ll discuss the details of that query  elsewhere. For now, suffice to say that the query returns only users who have an email address that begins with the letter H or with a letter greater than H (i.e., any letter than comes after H in the alphabet).

The < and <= signs can also be used to query string data. For example, this query limits returned data to users who have an email address that begins with the letters AB, or C:

email < "d"

While we’re at it, we should also mention that the blank spaces that come before and after the operator are optional. For example, this query also limits returned data to users who have an email address that begins with the letters AB, or C:

email<"d"

There’s no functional difference between the two queries; the only difference is that one is a bit easier to read than the other:

email < "d"

email<"d"