Business Data Catalog filters are used so that a backend data source does not have to return 1000's of rows of data to the SharePoint UI. This article discusses BDC filters with relation to databases, but the ideas are equally true for when you use a web service as a BDC data source.

As we know the Business Data Catalog Entity’s finder method executes a select query against a back end data source. The result can be 1,000’s of rows, which is not generally good for the users to page through or our database to process. A better situation would be to filter the data on the datasource side.

In BDC Method we need three things for each column that we want to be able to filter on
1, a database query or stored procedure which uses the column in WHERE clause
2, a Filter Descriptor defined in our BDC XML
3, and a Parameter with ‘IN’ direction defined in our XML

Here is some sample XML

bdc filters defined

In the above application definition file our finder methods has a single filter added to it. You can see the three components required highlighted in yellow - the Where clause, filter descriptor and parameter.

The Type attribute of the FilterDescriptor sets how the filter will work in the BDC Data List Web Part. With it set to comparison as it is in our sample XML the filter drop down will simply be 'is equal to'

bdc comparison filter

Comparison filter type is generally used with number and string type columns. If you do have a string type column you can also set your BDC FilterDescriptor to be of type Wildcard. This allows you to do interesting string filtering such as 'starts with' or 'contains'

bdc wildcard filter

If you use BDC Meta Man to generate your application definition files then it is very easy to define filters for your BDC Methods. You simply need to edit the entity on the design surface (by right clicking on it), move to the methods tab, select the finder method and then click on 'New Filter' button.

bdc entity management to add filters