# Add Safety View Filters in Safety Workbench

Learn how to apply filters on safety views. 

## About Safety View Filters

You can add filters on safety views and (optionally) make them available for use on the _Workbench Report_. If available on the report, Vault then uses the safety view filters along with the _Workbench Report_ filters to generate an output when the report is run. 

You can only add safety view filters if the <a href="/en/gr/752978/#workbench-view-columns">_Workbench View Columns_</a> section is populated in the associated _Principal View_. The fields you can filter on the safety view depend on the fields specified in the _Workbench View Columns_ for the _Principal View_. 

For more information about _Principal Views_ and _Workbench Views_, see <a href="/en/gr/752978/">Configure Safety Views in Safety Workbench</a>.

## How to Add Filters

To add filters to the safety view:
1. Navigate to **Business Admin > Objects > Workbench Views** and select a view.
2. In the _Filters_ section of the safety view, select a field from the dropdown.
3. Select an [operator][1].
4. Enter or select a field value, if applicable.
5. Set the **Available on report**, **Editable**, and **Required** checkboxes as needed. For more information about these options, see the [section below][2].
6. (Optional) Add more filters by selecting the **Plus** (**+**) icon to the right. 
7. (Optional) Delete a filter by selecting the **Minus** (**-**) icon. 



Each _Workbench View_ must be <a href="/en/gr/752978/#dependent-views">dependent on</a> one (1) unique _Principal View_, as the _Principal View_ determines the available filter fields you can select for this _Workbench View_. If you cannot select a field to filter on, ensure the current view is dependent on one (1) unique _Principal View_. 



### Set the Available on Report, Editable & Required Checkboxes 

After adding a safety view filter, there are additional configuration options available: 
* [Available on report][3]
* [Editable][4]
* [Required][5]

<a href="https://platform.veevavault.help/assets/images/saf-safety-view-filters.png" data-lightbox="saf-safety-view-filters.png" data-title="" data-alt="saf-safety-view-filters">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/saf-safety-view-filters.png" alt="saf-safety-view-filters" style=""  />
</a>

#### Available on Report 



Select the **Available on report** checkbox beside a filter to automatically make the filter available on any _Workbench Reports_ using this safety view. 

When a report user selects this safety view on a _Workbench Report_, Vault adds all filters set as _Available on report_ on the view's dependent views to the _Workbench Report_.

If you select only the _Available on report_ checkbox for a filter, users cannot edit any of the filter's components on the _Workbench Report_. 

These filters display in their own filter group, named after the respective dependent view. For more information on inherited filters, see <a href="/en/gr/752968/#inherited-criteria-and-filters">Use Workbench Report Filters</a>. 



#### Editable 



Select the **Editable** checkbox so that report users can edit the field value on the _Workbench Report_. Report users cannot edit the filtered field or operator. 



You can only select the **Editable** checkbox if you first select the **Available on report** checkbox. 

#### Required 



Select the **Required** checkbox to ensure that if the filter value is blank on the report, Vault will return a validation error when users save the report. Report users cannot edit the filtered field or operator. 



You can only select the **Required** checkbox if you first select the **Available on report** and **Editable** checkboxes. 

### Operators 

When Vault parses for data using filters, filter values are case-sensitive. The sections below describe filtering behavior for each operator. 

The operators available for selection on a filter depend on the filter's field type. Field types include the following:
* _Text_
* _Date_ and _DateTime_
* _Number_
* _Yes/No_
* _Object_
* _Picklist_
* _Multi-Value Picklist_
* _MedDRA_

#### Equals 

Returns results where all filter values are in the field. 

**Example filter**: (Field) _Case > Patient Initials_ (operator) _equals_ (value) _AD_

#### Is Not Equal To 

Returns results where the field does not contain any of the filter values. 

**Example filter**: (Field) _Case > Patient Initials_ (operator) _is not equal to_ (value) _AD_

#### Is Blank 

Returns results where the field contains no field value. 

**Example filter**: (Field) _Case > Study Arm_ (operator) _is blank_

#### Is Not Blank 

Returns results where the field contains a field value. 

**Example filter**: (Field) _Case > Study Arm_ (operator) _is not blank_

#### Starts With

For the _Text_ field type only, you can enter any value up to 50 characters. Vault returns results that start with this value.

**Example filter**: (Field) _Lot Number_ (operator) _starts with_ (value) _123abc_

#### Contains (Sensitive and Insensitive)

For the _Text_ field type only, you can enter any value up to 50 characters. Vault returns results that contain this value. You can select whether this filter value is case-sensitive or case-insensitive. 

**Example filters**: 
* (Field) _Lot Number_ (operator) _contains (sensitive)_ (value) _123abc_
* (Field) _Lot Number_ (operator) _contains (insensitive)_ (value) _123abc_

#### In

For the _Picklist_, _Multi-Value Picklist_, and _Object_ field types only. For multi-value picklists, the _in_ operator returns results that include at least one (1) of the filter values.

**Example filter**: (Field) _Case > Lifecycle State_ (operator) _in_ (value) _Open In Progress Complete_

#### Not In

For the _Picklist_, _Object_, and _MedDRA_ field types only, returns results that do not include the filter values. 

**Example filter**: (Field) _Case > Lifecycle State_ (operator) _not in_ (value) _Closed_

#### Is After

For the _Date_ and _DateTime_ field types only, returns results that succeed the filter value. 

**Example filter**: (Field) _Case > Event Onset (Normalized)_ (operator) _is after_ (value) _01 Apr 2024_

#### Is Before

For the _Date_ and _DateTime_ field types only, returns results that precede the filter value. 

**Example filter**: (Field) _Case > Event Onset (Normalized)_ (operator) _is before_ (value) _01 Apr 2024_

#### Is in the Range

For the _Date_ and _DateTime_ field types only, returns results that include date values that fall within the set date range.

#### Is Greater Than 

For the _Number_ field type only, returns results that are larger than the filter value. 

**Example filter**: (Field) _Case > Age_ (operator) _is greater than_ (value) _18_

#### Is Less Than

For the _Number_ field type only, returns results that are smaller than the filter value. 

**Example filter**: (Field) _Case > Age_ (operator) _is less than_ (value) _18_

#### Is Greater Than or Equal To

For the _Number_ field type only, returns results that are larger than or equal to the filter value. 

**Example filter**: (Field) _Case > Age_ (operator) _is greater than or equal to_ (value) _18_

#### Is Less Than or Equal To

For the _Number_ field type only, returns results that are smaller than or equal to the filter value. 

**Example filter**: (Field) _Case > Age_ (operator) _is less than or equal to_ (value) _18_

#### Relative Dates

Vault supports a number of filter operators that are relative to the current date for the _Date_ and _DateTime_ field types. For more information about relative filters and to see the complete list of supported relative date filter operators (with the exception of _Is in the last full_), see <a href="/en/gr/8591/#relative-filters">Using Report Filters</a>.

When <a href="/en/gr/860557/#run-all-reports">running a _Workbench Report_</a> that contains a filter with a relative operator, consider the following:
* For _is in the last_, _is in the next_, and _is not in the last_ operators:
    * A month is 30 days.
    * A year is 365 days.
* For all relative operators:
    * A start date starts at 00:00 (midnight) and an end date ends at 23:59:59.
    * The date and time is based on the following priority order:
      1. The <a href="/en/gr/752963/#advanced-options">_Timezone_</a> specified in the _Workbench Report_
      2. The _Timezone_ in the _User Profile_ of the user who configured the <a href="/en/gr/860557/#schedule-workbench-report-sets">schedule</a> that ran the _Workbench Report_

**Example**

A user configures a report to show completed cases for their product. They apply a filter to the report to show only cases in the last calendar month. If a user runs this report on August 2, Vault returns cases from July 1 to July 31; if a user runs this report on October 10, Vault returns cases from Sept 1 to Sept 30.

#### Equals Query

For the _MedDRA_ field type only, users can select a filter value from any standard MedDRA query (SMQ) or custom MedDRA query (CMQ). If the query contains higher level MedDRA terms, such as System Organ Class (SOC), the query will expand to the Lower Level Terms (LLTs) included within the SOC. These LLTs are matched against the _Event (LLT)_ field on _Case Adverse Events_ in your Safety Vault. Returned results include _Case Adverse Events_ that match any LLT within the expanded query.

**Example filter**: (Field) _Event (LLT)_ (operator) _equals query_ (value) [_Custom MedDRA Query_]

### Advanced Logic

For information about adding advanced logic, see <a href="/en/gr/8591/#advanced-logic">Using Report Filters</a>. The advanced logic option becomes available when there are at least two (2) filters in the group. If you use a filter in the advanced logic without populating the filter value, Vault ignores this filter when querying the data.

Advanced logic numbers appear next to the filters, as displayed in the following image:

<a href="https://platform.veevavault.help/assets/images/saf-advanced-logic-numbers.png" data-lightbox="saf-advanced-logic-numbers.png" data-title="" data-alt="saf-advanced-logic-numbers">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/saf-advanced-logic-numbers.png" alt="saf-advanced-logic-numbers" style=""  />
</a>

While advanced logic is turned on, you can add filters but cannot edit them. Vault copies the _Available on report_, _Editable_, and _Required_ settings from the previous filter to the newly added filter. To edit the filters, you can turn advanced logic off. 



The advanced logic option does not appear on the _Workbench Report_ for <a href="/en/gr/752968/#inherited-criteria-and-filters">inherited filters</a>, even if you set advanced logic on the safety view. The reason is to consider the scenario where only some filters in a filter group are available on the report, which would lead to an incomplete display of advanced logic.



[1]: #operators
[2]: #set-the-available-on-report-editable--required-checkboxes
[3]: #available-on-report
[4]: #editable
[5]: #required
