# How do I automatically construct a filter URL for passing through fields to a dashboard

**URL:** <https://community.omni.co/t/how-do-i-automatically-construct-a-filter-url-for-passing-through-fields-to-a-dashboard/71>\
**Category:** Modeling\
**Created:** [May 21, 2024, 2:51pm UTC](https://community.omni.co/t/how-do-i-automatically-construct-a-filter-url-for-passing-through-fields-to-a-dashboard/71 "2024-05-21T14:51:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.omni.co/jack/32/14_2.png) [@jack](https://community.omni.co/u/jack)\
**Post date:** [May 21, 2024, 2:51pm UTC](https://community.omni.co/t/how-do-i-automatically-construct-a-filter-url-for-passing-through-fields-to-a-dashboard/71/1 "2024-05-21T14:51:30Z")

</div>

Omni’s filter URL structure is built off of JSON. Because of this, we can use a JSON structure to create the filter parameters in the URL, which are later encoded and passed through to link to a dashboard in Omni.

Depending on the type of filter, there will be different expectations for the arguments.

In Omni, we have the following types of filters:

- string = `'string'`
- number = `'number'`
- date = `'date'`
- boolean = `'boolean'`
- null = `'null'`

Each filter has its own set of parameters that it takes in as JSON, and is then stringified and incorporated to a URL via the filter search parameters.

**String filters**

String filter parameters and data type expectations: `{kind: string, values: string[], is_negative: boolean, case_insensitive: boolean, hidden?: boolean}`

`kind`: indicates the type of string filter being enacted, possible values are:

- is equal to
- contains
- starts with
- ends with
- is empty

`values`: can be passed as an array of strings which are dependent on user input.

`is_negative`: determines if a filter is modified by a negative input or not. For example, a contains filter with is\_negative set to true will act as “does not contain”.

`case_insensitive`: determines if the filter is case sensitive or not to the results. Case insensitive with true, case sensitive with false

`hidden?`: determines if the filter is hidden or not. Hidden with true, visible with false

**Date filters**

Date filter parameters and data type expectations: `{kind: DATE_FILTER_KIND, left_side?: string, right_side?: string, is_negative: boolean, ui_type?: DATE_FILTER_UI_TYPE, isFiscal: boolean, hidden?: boolean}`

`kind`:

- IS\_ON\_DAY\_OF\_WEEK = ‘IS\_ON\_DAY\_OF\_WEEK’,
- IS\_ON\_DAY\_OF\_QUARTER = ‘IS\_ON\_DAY\_OF\_QUARTER’,
- IS\_IN\_MONTH\_OF\_YEAR = ‘IS\_IN\_MONTH\_OF\_YEAR’,
- IS\_ON\_DAY\_OF\_YEAR = ‘IS\_ON\_DAY\_OF\_YEAR’,
- IS\_AT\_HOUR\_OF\_DAY = ‘IS\_AT\_HOUR\_OF\_DAY’,
- IS\_IN\_QUARTER\_OF\_YEAR = ‘IS\_IN\_QUARTER\_OF\_YEAR’,
- IS\_ON\_DAY\_OF\_MONTH = ‘IS\_ON\_DAY\_OF\_MONTH’,
- BETWEEN = ‘BETWEEN’,
- ON\_OR\_AFTER = ‘ON\_OR\_AFTER’,
- BEFORE = ‘BEFORE’,
- TIME\_FOR\_INTERVAL\_DURATION = ‘TIME\_FOR\_INTERVAL\_DURATION’,
- TIME\_FOR\_UNIT\_DURATION = ‘TIME\_FOR\_UNIT\_DURATION’

`left_side?`: this is the value that is passed into the left side of a date filter. For a between kind, this would be the starting date in the range. For TIME\_FOR\_INTERVAL\_DURATION or ON\_OR\_AFTER it would be the starting point in time. For IS\_ON\_DAY\_OF\_WEEK, it would be the day of week.

`right_side?`: this is the value that is passed into the right side of a date filter. For a between kind, this would be the ending date in the range. For TIME\_FOR\_INTERVAL\_DURATION, it would be the length of time. For IS\_ON\_DAY\_OF\_WEEK or ON\_OR\_AFTER, it would be null.

`is_negative`: determines if a filter is modified by a negative input or not. For example, a contains filter with is\_negative set to true will act as “does not contain”.

`ui_type?`: This is to set the UI for the user of what will be shown in the filter. Because a single result can be achieved multiple ways, this allows for a certain control to be set on the UI side of what is shown to the user for a given filter. Not required, if not used we will make our best guess of what we show though the underlying logic will be dictated by the “kind” and “left\_side?” and “right\_side?” values. The possible values for a UI\_TYPE are:

- ANY\_TIME = ‘ANY\_TIME’,
- BEFORE = ‘BEFORE’,
- BETWEEN = ‘BETWEEN’,
- MONTH\_OF\_YEAR = ‘MONTH\_OF\_YEAR’,
- PAST = ‘PAST’,
- YEAR = ‘YEAR’,
- DAY = ‘DAY’,
- DAY\_OF\_WEEK = ‘IS\_ON\_DAY\_OF\_WEEK’,
- ON\_OR\_AFTER = ‘ON\_OR\_AFTER’,
- IS\_IN\_THE\_MONTH = ‘IS\_IN\_THE\_MONTH’,
- IS\_IN\_THE\_QUARTER = ‘IS\_IN\_THE\_QUARTER’,
- IS\_IN\_THE\_FISCAL\_QUARTER = ‘IS\_IN\_THE\_FISCAL\_QUARTER’,
- IS\_IN\_THE\_FISCAL\_YEAR = ‘IS\_IN\_THE\_FISCAL\_YEAR’,
- TIME\_FOR\_INTERVAL\_DURATION = ‘TIME\_FOR\_INTERVAL\_DURATION’,
- TIME\_FOR\_UNIT\_DURATION = ‘TIME\_FOR\_UNIT\_DURATION’,
- CUSTOM = ‘CUSTOM’,

`is_fiscal`: determines if the date filter operates over a fiscal period. If true, the fiscal offset specified in the model is used, otherwise if false it is not used.

`hidden?`: determines if the filter is hidden or not. Hidden with true, visible with false

**Numeric Filters**

Numeric filter parameters and data type expectations: `{kind: NUMERIC_FILTER_KIND, values: string[], is_negative: boolean, is_inclusive: boolean, hidden?: boolean}`

`kind`:

- LESS\_THAN = ‘LESS\_THAN’,
- GREATER\_THAN = ‘GREATER\_THAN’,
- EQUALS = ‘EQUALS’,
- BETWEEN = ‘BETWEEN’

`values`: string array of inputs to be filtered on

`is_negative`: determines if a filter is modified by a negative input or not. For example, a contains filter with is\_negative set to true will act as “does not contain”.

`is_inclusive`: determines if the filter is inclusive or not on the kind. inclusive with true, not inclusive with false

`hidden?`: determines if the filter is hidden or not. Hidden with true, visible with false

**Boolean Filters**

Boolean filter parameters and data type expectations: `{is_negative: boolean | null, treat_nulls_as_false?: boolean, hidden?: boolean}`

`is_negative`: determines if a filter is modified by a negative input or not. For example, a contains filter with is\_negative set to true will act as “does not contain”.

`treat_nulls_as_false`: determines if the filter treats null values as false or not. Does include and treat as false if the value is true, does not include if the value is false

`hidden?`: determines if the filter is hidden or not. Hidden with true, visible with false

**Null Filter**

Null filters are used whenever an “Is Null” filter criteria is selected, allowing this to be swapped in.

Null filter parameters and data type expectations: `{is_negative?: boolean, hidden?: boolean}`

`is_negative`: determines if a filter is modified by a negative input or not. For example, a contains filter with is\_negative set to true will act as “does not contain”.

`hidden?`: determines if the filter is hidden or not. Hidden with true, visible with false
