# Database Filters

Filters are used to hide files which match or do not match a set of specified rules. The creation and management of filters is done via a database file's Advanced Filter... menu item. Saved filters are available from the context menu's Hide Items Matching Saved Filter and Hide Items Not Matching Saved Filter submenus.

A filter can contain any number of nested compound conditions. A new compound condition is added by holding down the Option key when clicking on a + button. Filter conditions may be dragged to new locations.

You filter on database columns, treating the data as text or as an integer. When an existing column name is chosen, the data is treated as text. When a column name is prefixed with a #, the data is treated as an integer value. When the data associated with a column does not have a leading integer value, an integer value of zero will be assumed. Note that for columns containing symbolic ratings, the # form will work as expected.

When the Remove current filter before applying option is set, a filter will be applied on the full unfiltered set of database items. Note, the value of this option is preserved with a filter when it is saved.

Note that the is like operator supports the * (match 0 or more) and ? (match 1) wildcard characters. Unless you want your pattern to be anchored on the right make sure you specify a trailing *.

Saved filters can be deleted or chosen for editing via the Manage... button. When managing filters, you can delete them or select them for editing.

### Relative Date testing

When a comparison uses a pure column, ie. not one with a # prefix, escape sequences are processed to allow for relative date testing. The following escape sequences are supported:

\#Y
  # is an optional positive integer value which represents the number of years before the current year. Only the year component of the date is inserted. For example: \2Y will return 2014 if the current year is 2016.
\#y
  The same as \#Y with the exception that the current month and day are also inserted. For example: \1y will return 2015-06-04 if the current date is 2016-06-04.
\#M
  # is an optional positive integer value which represents the number of months before the current month. Only the year and month components of the date are inserted. For example: \10M will return 2015-08 if the current date is 2016-06.
\#m
  The same as \#M with the exception that the current day is also inserted. For example: \1m will return 2016-05-04 if the current date is 2016-06-04.
\#D
  # is an optional positive integer value which represents the number of days before the current date. For example: \32D will return 2016-05-03 if the current date is 2016-06-04.
\#d
  The same as \#D.
\\
  Used to ignore a \ character. For example: x\\y will insert x\y

Examples: Assume a date column named Purchased

Filter on items purchased in the current year
  Purchased begins with \Y
Filter on items purchased in the last six months
  Purchased is greater than \6M
Filter on items purchased in the last 10 days
  Purchased is greater than \10D