# Filters

## Overview

A filter is a set of limitations to the table fields for allowing users to restrict display results by building one or more queries. [Labii ELN & LIMS](https://www.labii.com/) allows users to create filters for any table within the platform.

{% embed url="<https://youtu.be/sSCg5CI_QAU>" %}

## List of filters

Each table has its own filters. Open a table and click the **Filters** tab to view the list of filters.

#### **There are 3 ways to access filters for a particular table:**

#### From record list view:

* Click “filters” from sidebar to the left or the navbar to the top
* Select “My xxx Filters” or “All xxx Filters”

#### From settings:

* Select Settings
* Select Tables
* Click Filters tab

![](https://3607108856-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LHVg57XIRcjV-Vbubtn%2Fuploads%2Fgit-blob-cf71ff54b6500c3a34f3842b396c3d3f6275aa4d%2Fsettings-tables-filters.webp?alt=media)

### Search filters

You can search filters by typing a keyword into the search bar in the **filters list view**, and then clicking **Search**. The search results can always be cleared by clicking the **Clear** button.

### Filter filters

With the **Filter** function, you can limit the number of sections displayed. You can do that by clicking **Active filters** and then selecting a filter from the dropdown. Here are a list of filters:

* **All filters**. Filter to display all filters of the table.
* **Active filters**. Filter to display the active filters.
* **Archived filters**. Filter to display the archived filters.
* **My filters.** Filter to display a list filters assigned to you.

## Filter detail

Click a filter name to see full detail of a filter.

### Filter fields:

* **Sid** - The unique identifier of the filter
* **Name** - The name of the filter that will be displayed to users
* **Description** - Provide a description of the filter and all other necessary information to help others in the same organization understand what this filter is for
* **Icon** - Choose an icon that visually represents the filter
* **Show in Menu** - Enable to display this filter in the table's filter menu. Uncheck to hide it from the menu
* **Ref** - Reference text to matching current filter in the json template
* **Query** - Query is in JSON format. Use an array for OR operator. The list of current variables (Record and User) are available at <https://docs.labii.com/api/variables>
* **Query Exclude** - Query in JSON format to be excluded
* **Permissions**
  * **Owners** - Select users who can edit this filter. The filter creator is automatically included as owner
  * **Teams** - Select teams that can use this filter. Team members can view but not modify the filter
* **Notifications**
  * **Digest Frequency** - Choose how often to receive summary emails for records matching this filter. Options: none, daily, weekly, monthly, or annually
  * **ICS** - The ICS link to sync with your calendar for records matching this filter
* **Configuration**
  * **Title** - Reference to the column that should display as title of a sample. The title will be displayed when adding a sample via URL
* **Date Updated** - Timestamp of the last modification to this filter
* **Date Created** - Timestamp when this filter was created
* **Is Archived** - If checked, filter is not available for use. Check this to hide/delete this filter

## Add filters

#### **There are many methods to add filters:**

1. Add filter from the search results:
   1. Open record list view
   2. Click Search Bar -> Advanced Search
   3. Fill in the search queries
   4. Click "Save as filter" button
2. Add filter from list view
   1. Open record list view of a table
   2. Click filter dropdown
   3. Choose **Add filter** option
3. Add filter from settings
   1. Click Settings -> Tables
   2. Click **Filters** tab
   3. Click "**Add Filter**"

**Enhancing Results by Merging Multiple Filters**

Labii allows you to combine results from multiple filters. To do this, create a filter and update the query with the following keys and values:

* To use "OR" logic for filters, use the key `filter__sid__in`. Example: `{"filter__sid__in": "xxx,xxx,xxx"}`
* To use "AND" logic for filters, use the key `filter__sid`. Example: `{"filter__sid": "xxx,xxx,xxx"}`

## Add filter from template

Labii consistently updates the templates of table filters. You can use the **Add filter from template** function to add a missing filter from a template.

{% stepper %}
{% step %}
Click the **Add Filter** dropdown button
{% endstep %}

{% step %}
Select **Add from a template** from the dropdown menu
{% endstep %}

{% step %}
Choose a filter from the modal that appears
{% endstep %}
{% endstepper %}

## Import filters

Multiple filters can be created simultaneously using **Import**. You can do this by clicking **Import** in the section list view.

## Export filters

You can export a list of filters by clicking **Export** button and select one option from the dropdown.

## Delete filter

In the filters list view, a filter can be deleted by clicking the **Delete** icon next to it.

## Sent notifications

When you define the "Digest Frequency" on a filter, you will be able to receive notifications for the results of the filter.

## Examples

1. Identify and retrieve rows that are missing a specific column's data.
   1. query: `null`
   2. query\_exclude: `{"cell__column__sid": "xxx"}`
