Using Filters in BCS Meta Man

Introduction

In this walkthrough we will demonstrate how to define BCS filters for BCS external content types when using BCS Meta Man. We support filters for SQL and Oracle, but in this sample we will use SQL server. You can do the same steps for Oracle and define filters for Oracle tables as well.

Prerequisites

  • SharePoint Foundation 2010 or SharePoint Server 2010
  • Visual Studio 2010 professional or higher
  • BCS Meta Man
  • AdventureWorks SQL database
  • Follow the “BCS Meta Man-Getting started” tutorial to create your External Content Type, but don’t deploy yet.

Walkthrough

1) Drag and drop any two tables you want, in this walkthrough we will use Department and Product tables; we will define a comparison filter for Product table and Wildcard for Department. Your diagram should look like this.

External Content Types created in BCS Meta Man

2) Right click on the Department table and choose Manage Entity.

Manage the External Content Type

3) In the Entity Management dialog go to Methods tab and select the Finder method.

Manage the methods so you can add BCS Filters

4) Click on “Add Filter” button in the “Filters” section and configure a wildcard filter for Department table’s Finder method. Click on OK button, and then Save entity’s modifications.

Add a new BCS Filter

5) Using the above mentioned steps, define a comparison filter for the Product table.

Create a comparison BCS Filter

6) If you open the generated service classes, you’ll find that the C# methods have been modified to accept filter parameters and filter the data being returned.

7) Rebuild the project and press CTRL+F5 to deploy the solution.

8) Go to your SharePoint site, and add two BCS List web parts. Set Department as a type for one of them and Product as a type for the other BCS List web part.

BCS List Web Parts with filters

9) Try to enter some filter values to display the records.

Using BCS Filters