# JSTableFilter

## Overview

The `JSTableFilter` represents a server-side table filter in Servoy, used for managing database filters with enhanced control over server broadcasting. The class provides properties and methods to define and interact with table filters dynamically.

## Functionality

A `JSTableFilter` is associated with a server and a specific table. It includes read-only properties to retrieve the server and table names. The `dataBroadcast` method allows setting a flag for database broadcast filtering, ensuring that only specific updates are broadcasted to clients.

The filter supports operations such as `in` or `=` for applying constraints on data visibility and is tightly integrated with Servoy's database manager capabilities. Filters are set and modified through server-side methods, making them a powerful tool for data management in multi-client environments.

## Properties Summarized

| Type                       | Name                      | Summary                  |
| -------------------------- | ------------------------- | ------------------------ |
| [String](../js-lib/string) | [serverName](#servername) | Returns the server name. |
| [String](../js-lib/string) | [tableName](#tablename)   | Returns the table name.  |

## Methods Summarized

| Type                           | Name                                                 | Summary                     |
| ------------------------------ | ---------------------------------------------------- | --------------------------- |
| [JSTableFilter](jstablefilter) | [dataBroadcast(broadcast)](#databroadcast-broadcast) | Set the dataBroadcast flag. |

## Properties Detailed

### serverName

Returns the server name.

**Type**\
[String](../js-lib/string) String server name.

**Sample**

```js
var filter = databaseManager.createTableFilterParam('admin', 'messages', 'messagesid', '>', 10)
var serverName = filter.serverName // admin
```

### tableName

Returns the table name.

**Type**\
[String](../js-lib/string) String table name.

**Sample**

```js
var filter = databaseManager.createTableFilterParam('admin', 'messages', 'messagesid', '>', 10)
var tableName = filter.tableName // messages
```

## Methods Detailed

### dataBroadcast(broadcast)

Set the dataBroadcast flag.

When the dataBroadcast flag is set, this filter will be used server-side to reduce databroadcast events for clients having a databroadcast filter set for the same column with a different value.

Note that the dataBroadcast flag is \*only\* supported for simple filters, only for operator 'in' or '='.

**Parameters**

* [Boolean](../js-lib/boolean) **broadcast** Boolean set to true this is a databroadcast filtering filter. (default false)

**Returns:** [JSTableFilter](jstablefilter) filter.

**Sample**

```js
var filter = databaseManager.createTableFilterParam('example', 'orders', 'clusterid', '=', 10).dataBroadcast(true)
```

***
