All values of the Tags field for selected objects are used to create grouping fields. To eliminate specific values from being used for grouping—without affecting the selection of the owning object—the
EXCLUDE function can be used:
When the grouping field is a text field, the values passed to the EXCLUDE function are whole, case-insensitive values—not terms—and must be enclosed in quotes. In the example above, groups matching the value
Confidential or
Internal or case variations of these are excluded. The values used for text scalars can contain wildcards
? and
*. For example:
The only groups generated are those matching Confidential and
Internal and case variations of these; all other values are skipped. Again, when the grouping field is a text scalar, the value must be enclosed in quotes, and it can contain wildcards
? and
*.
The values passed to INCLUDE and
EXCLUDE must be compatible with the corresponding scalar type field: integers for
integer or
long fields, Booleans for
boolean fields, etc. Additionally, the keyword
NULL (uppercase) can be used to include or exclude the
(null) group normally generated when at least one object has a null value for the grouping field. Example:
INCLUDE and
EXCLUDE can be used in the same grouping expression. Because the functions are processed in order from left-to-right, it is most useful to use
INCLUDE first, to select a overly-broad set of values, and then use
EXCLUDE to prune-out unwanted values.
INCLUDE and
EXCLUDE can also be used in conjunction with other grouping functions, as shown in this example:
This query returns a COUNT of the
TOP 10 most-used
Name values, but it only
INCLUDEs names that begin with “aaron”. Within those names, it
EXCLUDEs names that end with “murphy”.