# Search for Non-empty and Empty Fields

To obtain results for all records in which a particular field is non-empty - i.e., is filled in -, we can search for field:*. If the field name contains more than one word, we should use _ as a word separator. For example, field_name:*. Conversely, if you want all the records where a particular field is empty, just put a dash before the search expression to negate its meaning. Example: -field_name:*.

Using an example from our demo solution, in order to search for all the records of the Countries definition whose field latest_household_survey is non-empty, we just need to enter the query latest_household_survey:* on the search box (try (opens new window)). In this case, we can see that 152 of the 263 country records included have this field filled out:

If we want to search for all instances where this field is empty, the appropriate expression is -latest_household_survey:* (try (opens new window)). When we enter this expression, we can see that it is valid: as expected, only 111 of the 263 country records do not have this field filled in:

Here is a brief video providing a real-time demonstration of this example:

# Search for attachments

This type of expression that we just mentioned is especially useful for finding all definition records with attached files. If we have a definition field named File that is being used to store all sorts of file attachments, we can search for all the records with attachments by inserting the expression file:* in the search box. If we want our search results to be limited to a particular file format, we need to insert a dot and the acronym for that file extension after the asterik. For instance:

  • file:*.pdf in the case of text files saved in the PDF format;
  • file:*.png in the case of image files saved in the PNG format;
  • file:*.jpg in the case of image files saved in the JPEG format.