Skip to content

Where

Where is used to filter the data in the result set. It filters data in the database, before returning it to SearchKit. To filter it after being returned from the database, use Having.

Elements locations

Description

There are four main components: 1. the element you want to compare, 1. the “operator,” 1. the value (or field) to compare against, and 1. whether to compare with a value or a field.

In general, the operators are the same as the similarly-named arithmetic or SQL operators.

Here are a few tips: 1. Matches Pattern will match a regular expressions pattern. 1. Is Like matches a complete field, so you usually want to use it with wildcards if you want to find parts of the field, like %search term%. 1. Contains is useful for searching in serialized fields (fields that store multiple values together, such as Contact Subtype which could be Parent, Volunteer, Staff). It matches only a full value like Parent, not parts of a value. 1. Negated operators such as Not Like, , or Doesn't Contain won't match NULL fields that have no value. They only match fields that have a value and the value doesn't match the criteria. If you want NULL fields as well, you can search for ≠ searchterm OR Is Empty.

Here is an example which only includes contacts whose email address contains ‘.gov’:

Example email address .gov

And here is an example which includes contacts whose primary address is not the same as their billing address:

Example different email addresses