BCS Multiple Finder Methods for External Content Types

One issue with the Business Data Catalog was that you could only define one Finder method per Entity. This meant that if you wanted to use two different SQL Views that each returned different columns from a table you would have to actually create two completely different entities.

With Business Connectivity Services you can now define multiple Finder methods, and then pick within the UI or object model which method to use. In this walk through we show you how to use SharePoint Designer 2010 and the BCS to define multiple Finder methods for your External Content Types.

Pre-requisites..

  • SharePoint Designer 2010
  • A Data Source – We will be using the AdventureWorks2000 Products table

How to..

  1. Open SharePoint Designer 2010
  2. Connect to your SharePoint Site
  3. Click on ‘External Content Types’ from the Site Objects list

     1

  4. Click ‘External Content Type’ (ECT) from the ‘New’ section of the ribbon
  5. Give your ECT a meaning full name – You just need to click on the existing text to edit

    2   –> 3

  6. Click the link in the External Content Type Operations section to ‘discover external data sources and define operations’

     4

  7. Click ‘Add Connection’ and choose ’SQL Server’
  8. Enter your connection credentials and click OK

     5

  9. Expand the tree view to show the ‘Products’ Table

     6

  10. Right Click on the Table and choose ‘New Read List Operation’
  11. Change the ‘Operation Name’ and ‘Operation Display Name’ to “All Products and Information”, Click Next
  12. We are going to ignore the filter for now (you should usually add a filter when you are returning a large data set), click Next
  13. Click ‘Finish’ on the ‘Return Parameter Configuration’ screen
  14. We have now created a ‘Read List’ Finder method which returns all items from our Products table with all of the columns

    7  

  15. Right Click on the Table and choose ‘New Read List Operation’ again
  16. Change the ‘Operation Name’ and ‘Operation Display Name’ to “All Product Names”, Click Next
  17. Ignore the filter screen again – Click Next
  18. On the ‘Return Parameter Configuration’ screen uncheck all of the ‘Data Source Elements’ apart from ‘ProductID’ and ‘Name’

    8  

  19. Click ‘Finish’
  20. We now have our two ‘Finder’ methods defined

    9  

  21. Click ‘Save’

     10

  22. The ECT will be saved to the BDC Metadata Store

    11  

  23. Once the document has been saved we can navigate to our SharePoint Site
  24. Add a ‘Business Data List’ Web Part to your page

     12

  25. Click on the icon to bring up the ECT Picker
  26. Select the AdventureWorks Products ECT
  27. Click ‘OK’
  28. In the View section you have the 2 Finder methods that we created, the ‘All Products and Information’ and the ‘All Product Names’

    14

  29. Select the default option of ‘All Products and Information’
  30. Click ‘’OK’
  31. All Products and Information are returned

    15  

  32. Click to edit the Web Part again
  33. Choose the ‘All Product Names’ View
  34. Click OK
  35. All the Product Names are now returned

    16   

<phill/>