Filters
Filters limit the entities a widget displays to those that match conditions on attribute or telemetry values. You define filters at the dashboard level and assign them to widget data sources.
Create a Filter
Section titled “Create a Filter”- In edit mode, click Filters in the toolbar, then click Add filter.
- Enter a Filter name. Enable Editable to let users change the filter in view mode (see Editable flag).
- Click Add key filter and set the Key type, Key name, and Value type. In the filters table below, choose an Operation, enter a Value, and click Add.
- Add more key filters if needed, and use the And/Or toggle in the Key filters section to set how they combine. Filter preview shows the resulting expression.
- Click Add to save the filter, then Save in the Filters dialog to apply it to the dashboard.
The toggle applies to all key filters in the filter:
- And — an entity must match every key filter, for example
temperature > 25 AND humidity > 70. - Or — an entity must match at least one key filter, for example
temperature > 25 OR humidity > 70.
Key Filter Settings
Section titled “Key Filter Settings”Each key filter starts with three fields:
| Field | Description |
|---|---|
| Key type | Type of entity data to filter on: Time series, Attribute, Entity field, etc. |
| Key name | Name of the telemetry key or attribute (case-sensitive). |
| Value type | Data type of the value: Numeric, String, Boolean, etc. |
Adding Operations
Section titled “Adding Operations”Use the Add and Add complex buttons inside a key filter to define conditions on that key. These operations combine independently of the And/Or toggle between key filters:
- Add — adds a simple comparison, for example greater than 30. Simple operations are joined with AND.
- Add complex — adds a group of sub-conditions joined by AND or OR. Groups can be nested, for example (A AND B) OR (C AND D).
Example — temperature between 10 and 30:
- Operation 1 (Add): greater than
10 - Operation 2 (Add): less than
30
Example — battery level below 10% or above 95%:
- Add complex, operator OR
- Sub-operation 1: less than
10 - Sub-operation 2: greater than
95
Dynamic Value
Section titled “Dynamic Value”Comparison values are static by default. To read the threshold from an attribute at runtime, set the Dynamic source type:
| Option | Description |
|---|---|
| No dynamic value | Use a static value (default). |
| Current tenant | Read the threshold from a tenant attribute. |
| Current customer | Read the threshold from the current customer’s attribute. |
| Current user | Read the threshold from the current user’s attribute. |
With a dynamic source selected, enter the attribute name in the Source attribute field. Each user or customer then sees results filtered by their own attribute value.
Filter Predicate User Parameters
Section titled “Filter Predicate User Parameters”The gear icon in each operation row opens the Edit filter predicate user parameters dialog. It controls how the operation value appears to dashboard users:
| Parameter | Description |
|---|---|
| Editable | Lets users change the value from the dashboard without entering edit mode. |
| Custom label | Label shown for the condition. When disabled, ThingsBoard generates one, for example temperature greater than. |
| Display order | Position of the condition in the filter panel. |
| Unit | Source unit, optional conversion, and target units for the metric, imperial, and hybrid systems. |
Assign a Filter to a Widget
Section titled “Assign a Filter to a Widget”A filter takes effect only after you assign it to a widget data source:
- Open the widget for editing.
- In the Data tab, find the data source row.
- Select the filter in the Filter field.
- Click Apply, then Save in the dashboard toolbar.
Each data source uses one filter at a time.
Editable Flag
Section titled “Editable Flag”When a filter’s Editable toggle is enabled, users without dashboard edit access can switch the active filter from the toolbar. Disable it to lock the filter.
The per-operation Editable setting in Filter predicate user parameters is separate: it controls whether users can change the value of a specific operation.
See Also
Section titled “See Also”Was this helpful?