---
url: https://gudhub.com/docs/core-api/filter/filter-overview/
title: "Filter Overview\n                #"
description: "Filter is the important entities of GudHub. It is responsible for the sorting and structuring data. There are several items that have filter: table, . Some of t"
lang: uk
updated: 2026-09-11T14:12:25.246Z
---

# Filter Overview [#](https://gudhub.com/docs/core-api/filter/filter-overview/#filter-overview)

**Filter** is the important entities of GudHub. It is responsible for the sorting and structuring data.

There are several items that have filter: table, . Some of them use it inside the code, others allows to use it in the application. The programmer decides which item will have the filter.

Every data that display items has its own filtering set. The filtration takes field values for finding and selecting needed data. Also, you can configure filter for different fields and select the type of the filtration.

The filter accepts different types of search values (string, number etc.) and can be applied for different types of fields.

It accepts two arrays as arguments:

Copy

```js
import GudHub from '@gudhub/core';
const gudhub = await new GudHub();
let items = [{
  "item_id": 2987986,
  "fields": [{
        "field_id": 645888,
        "field_value": "John",
      }],
  },
  {
  "item_id": 2987996,
  "fields": [{
        "field_id": 645888,
        "field_value": "Johana",
      }]
  }
];

let filter_list = [{
    "data_type": "text",
    "field_id": 645888,
    "search_type": "search",
    "selected_search_option_variable": "Value",
    "valuesArray": ["john"]
    }
];

gudhub.filter(items, filter_list);
```

| Name | Type | Description |
| :-- | :-- | :-- |
| items | `array` | _array of items which will be filtered_ |
| filter\_list | `array` | _array of filters which will be applied to items_ |

> Filter is not applied without search values.

**Filter** allows you to add several filters for the same item at the same time. In turn, the fields can have only one filter. But, as fields can contain multiple value, filters can search for a few ones.

As for filters JSON, all filters data is contained in filters\_list which in turn located in the certain item. For example:

Copy

```json
filters_list: [{
    "data_type": "text",
    "field_id": 603733,
    "search_type": "contain_or",
    "selected_search_option_variable": "Value",
    "valuesArray": ["field value",...],
},...]
```

As you can see, filters\_list consists of the filter object. If there is no filter in item, list is empty.

| Property | Type | Description |
| :-- | :-- | :-- |
| filter\_list | `array` | _array of object with data about filtering_ |
| data\_type | `string` | _contains the values type_ |
| field\_list | `number` | _contains ID of the field that is being filtered_ |
| search\_type | `string` | _contains the type of searching_ |
| selected\_search\_option\_variable | `string` | _allows to add environment value_ |
| valuesArray | `array` | _contains all values, by which filtering is carried out_ |

## getFilteredItems [#](https://gudhub.com/docs/core-api/filter/filter-overview/#getfiltereditems)

There is also a separate method that returns items with filters applied to them. This method accepts the same arrays as the filter method plus a few new arguments. **getFilteredItems** can be call in two ways:

-   [Directly through Utils](#through-utils)
-   [Through Lib](#through-lib)

They are not that different, but have some differences.

### Through Utils [#](https://gudhub.com/docs/core-api/filter/filter-overview/#through-utils)

Accepts all arguments separately.

Copy

```js
import GudHub from '@gudhub/core';
const gudhub = await new GudHub();
let items = [{
  "item_id": 2987986,
  "fields": [{
        "field_id": 645888,
        "field_value": "John",
      }],
  },
  {
  "item_id": 2987996,
  "fields": [{
        "field_id": 645888,
        "field_value": "Johana",
      }]
  }
];

let filter_list = [{
  "data_type": "text",
  "field_id": 645888,
  "search_type": "search",
  "selected_search_option_variable": "Value",
  "valuesArray": ["john"]
  }
];

let element_app_id = 2343552;

let app_id = 13453;

let item_id = 122345;

let field_group = [];

let filteredItems = await gudhub.utils.getFilteredItems(items, filters_list, element_app_id, app_id, item_id, field_group);
console.log(filteredItems);
```

| Property Name | Type | Description |
| :-- | :-- | :-- |
| items | `array` | _array of items for filtration_ |
| filter\_list | `array` | _array of filters which are applied to items_ |
| element\_app\_id | `number` | _accepts ID of the application in which the item is configured_ |
| app\_id | `number` | _contains ID of the application whose items will be filtered_ |
| item\_id | `number` | _contains ID of item where the filter is located_ |
| field\_group | `number` | _accepts ID of the field by which items are grouped according to_ |

### Through Lib [#](https://gudhub.com/docs/core-api/filter/filter-overview/#through-lib)

Accepts some arguments as properties of an object named **options**.

Copy

```js
import GudHub from '@gudhub/core';
const gudhub = await new GudHub();

let items = [{
  "item_id": 2987986,
  "fields": [{
        "field_id": 645888,
        "field_value": "John",
      }],
  },
  {
  "item_id": 2987996,
  "fields": [{
        "field_id": 645888,
        "field_value": "Johana",
      }]
  }
];

let filter_list = [{
  "data_type": "text",
  "field_id": 645888,
  "search_type": "search",
  "selected_search_option_variable": "Value",
  "valuesArray": ["john"]
  }
];

let options = {
  element_app_id: "665778",
  app_id: "342323",
  item_id: "3424222",
  field_group: "34323"
};


let filteredItems = await gudhub.getFilteredItems(items, filters_list, options);
console.log(filteredItems);
```

| Property Name | Type | Description |
| :-- | :-- | :-- |
| items | `array` | _array of items_ |
| filter\_list | `array` | _array of filters which are applied to items_ |
| options | `object` | _contains additional settings_ |
| element\_app\_id | `number` | _ID of the application where the element is rendered (could be view container)_ |
| app\_id | `number` | _ID of the application where items will be filtered_ |
| item\_id | `number` | _contains ID of item where the filter is located_ |
| field\_group | `number` | _accepts ID of the field by which items are grouped according to_ |

## Search Types [#](https://gudhub.com/docs/core-api/filter/filter-overview/#search-types)

The filter can accept multiple values for searching at the same time. For comfortable filtering you can choose on what basis the filter will select the fields. For example, you want to get all results that contain you value or on the contrary all results without your value. So, you can configure filter for such needs due to search\_type. It has a large range of values:

-   [contain\_or](https://gudhub.com/docs/core-api/filter/contains/)
-   [contain\_and](https://gudhub.com/docs/core-api/filter/contains/)
-   [not\_contain\_or](https://gudhub.com/docs/core-api/filter/contains/)
-   [not\_contain\_and](https://gudhub.com/docs/core-api/filter/contains/)
-   [equal\_or](https://gudhub.com/docs/core-api/filter/equals/)
-   [equal\_and](https://gudhub.com/docs/core-api/filter/equals/)
-   [not\_equal\_or](https://gudhub.com/docs/core-api/filter/equals/)
-   [not\_equal\_and](https://gudhub.com/docs/core-api/filter/equals/)
-   [phone\_equal\_or](https://gudhub.com/docs/core-api/filter/phone-equal/)
-   [distance](https://gudhub.com/docs/core-api/filter/distance/)
-   [search](https://gudhub.com/docs/core-api/filter/search/)
-   [bigger](https://gudhub.com/docs/core-api/filter/number-filters/)
-   [lower](https://gudhub.com/docs/core-api/filter/number-filters/)
-   [range](https://gudhub.com/docs/core-api/filter/range/)
-   [date\_in](https://gudhub.com/docs/core-api/filter/date-filters/)
-   [date\_out](https://gudhub.com/docs/core-api/filter/date-filters/)
-   [recurring\_date](https://gudhub.com/docs/core-api/filter/recurring-date/)
-   [value](https://gudhub.com/docs/core-api/filter/value/)

For convenience, we can divide some of them into groups:

1.  Contains
2.  Equals
3.  Number filters
4.  Date filters

The rest of filters will be described separately.

All details about them you can read in the next chapters.
