ENTERPRISE

Business Intelligence in SharePoint 2010 with Business Connectivity Services : Consuming External Content Types (part 3) - Business Connectivity Services Web Parts

 
2/12/2011 3:23:46 PM

Business Connectivity Services Web Parts

Up until this point, all the functionality covered in this article is available with SharePoint Foundation 2010, the unlicensed version of SharePoint. The Enterprise version of Microsoft SharePoint Server offers some additional functionality.

Specifically, a set of Business Data web parts are available. These web parts provide a third way that BCS external content can be consumed in SharePoint and can be useful for building dashboard pages.

Consider, for example, a Customer Details page, which would show profile information—Name, Phone Number, Company, and Email Address—about the customer in one web part. Another web part could show recent orders—including Order Date, Total Amount, and Order Status. A last one would list a set of recent customer service calls. Having all this information available in one screen would make it easier for a Customer Service Representative to quickly access all relevant information, without having to go from one application to another. It doesn’t even matter that all this information would live in a series of different SharePoint lists and database tables, or even in separate databases. The power of BCS is the capability to pull it all together into one location.

Before using these web parts, however, SharePoint Server Enterprise Site Collection Features needs to be activated. Activating this feature will add the web parts previously described to the site collection’s web part gallery. Complete the following steps:

1.
In Internet Explorer, open the SharePoint site used. The URL will be something like http://mss2010.mydomain.com/sites/BCSSample/.

2.
From the Site Actions menu, select Site Settings.

3.
Under the Site Collection Administration heading, click the Site Collection Features link.

4.
Locate SharePoint Server Enterprise Site Collection Features, and click the corresponding Activate button.

The following sets of examples show how to use three main web parts to build this dashboard: Business Data Item, Business Data Related List, and Query String URL Filter.

Business Data Item Web Part

The first web part of interest is the Business Data Item web part, which can be used to show the details of a single BCS record. The following example will use this web part to show the main profile information about a customer—Name, Phone Number, Email Address, and so on:

1.
In Internet Explorer, return to the home page of the SharePoint site .

2.
From the Site Actions menu, select Edit Page. The web page should show Left and Right web part zones.

3.
In the Left Zone, click the Add a Web Part link.

4.
In the Categories section, select the Business Data category. In the Web Parts section, select the Business Data Item web part. Click Add.

5.
The Business Data Item web part should display in the Left web part zone. Click the link in the web part that says, Open the Tool Pane to modify the web part settings.

6.
For the Business Data Item section of the settings, enter the word Customer in the Type field, and check the Check Mark icon to locate the BCS Customer external content type. After the external content type is located, it should display in the Type box as underlined.

7.
In the View list box, select Default (Read Customer Item).

8.
In the Item field, enter the number 1, and click the Check Mark icon to locate the record with CustomerID of 1. When the record is located, it should also display in the box as underlined.

9.
Under the Fields heading, click the Choose box to change which fields are displayed. Deselect the NameStyle, Suffix, PasswordHash, PasswordSalt, rowguid, and ModifiedDate fields, leaving the remaining fields selected. Click OK.

10.
Click OK in the web part settings to save the changes to the web part. When the page reloads, the record for Orlando Gee should be displayed, as shown in Figure 31.12.

Figure 8. Configured Business Data Item web part.

Business Data Related List Web Part

Another important component of the Customer Dashboard page is the Recent Orders web part. As the name implies, this web part will show recent orders associated with the given customer. This web part will use the Business Data Related List web part.

The Business Data Related List web part uses associations defined between two external content types. Recall the earlier set of exercises to create the BCS Order external content type, which included an association to the BCS Customer external content type. The Business Data Related List web part will leverage this association to display only the orders that relate to a selected customer:

1.
From the Site Actions menu, select Edit Page.

2.
In the Left Zone, click the Add a Web Part link.

3.
In the Categories section, select the Business Data category. In the Web Parts section, select the Business Data Related List web part. Click Add.

4.
The Business Data Related List web part should display in the Left web part zone, just above the BCS Customer web part. Move the new web part below the BCS Customer web part by clicking on the Business Data Related List header, holding the mouse button down, and dragging it beneath the BCS Customer web part. Release the left mouse button.

5.
Click the link in the web part that says Open the Tool Pane to modify the web part settings.

6.
In the Type box, click the Select an External Content Type icon. Notice that only the Sales Orders content type appears in the selection list. This is because Sales Orders was the only external content type for which an association was defined. Select Sales Orders and click OK.

7.
In the Relationship list box, select Sales Order Customer Association that should be the only option in the list. Click OK to save the web part settings.

8.
All the columns from the Sales Order table should display. To reduce the columns displayed, use Internet Explorer’s horizontal scroll bar to move to the right. Click the Edit View link, which appears just above the right-most column.

9.
In the Columns section of the view settings page, deselect all EXCEPT the following columns: OrderDate, ShipDate, SalesOrderNumber, CustomerID, SubTotal, TaxAmt, and TotalDue. Click OK.

10.
Next, a connection must be established between the two web parts so that the value used in the BCS Customer web part (Business Data Item web part) is passed to the Sales Orders List web part (Business Data Related list web part).

11.
From the Site Actions menu, select Edit Page.

12.
Hover over the BCS Customer web part header. Click the down-arrow that appears at the right of the web part header. Click Connections, select Send Selected Item To, and select Sales Orders List, as shown in Figure 9.

Figure 9. Establishing a connection between two web parts.

Query String Filter Web Part

Recall that the operations assigned to both the Customer and SalesOrderHeader operations contain filters for CustomerID. Rather than try to view all customers and all sales order on one web page, the orders information is most usable when viewing it one customer at a time To isolate the records to just those for a single customer, a filter can be used.

Furthermore, it would be inefficient to create a separate page for every customer in the database and have to design it the exact same way each time, changing only the CustomerID in each web part. Instead, it would obviously make more sense to create a single page, and simply differentiate between customers via a single parameter.

A query string parameter provides this capability. A query string parameter is the portion of a website address that appears after the question mark. For example, a query string parameter might be something like CustomerID. The web address to a page might look something like http://mss2010.abcco.com/Pages/CustomerDashboard.aspx?CustomerID=227. This URL will pull up the page called CustomerDashboard.aspx and reference the customer whose ID is 227.

The Query String Filter web part is designed to read the designated query string parameter and then send that value to connected web parts. To see this web part in action, complete the following steps:

1.
From the Site Actions menu, select Edit Page.

2.
In the Left zone, click the Add a Web Part link.

3.
Select the Filters category and the Query String Filter web part. Click Add.

4.
Click the Open the Tool Pane link to edit the web part settings.

5.
In the Filter Name property, type CustomerID.

6.
For the Query String Parameter Name, type CustomerID.

7.
Finally, assign 1 as the default value. This last parameter is not critical but will assign an ID to be used if the user lands on the page without the CustomerID being specified.

8.
Under the Appearance heading, change the web part title to CustomerID Query String Filter.

9.
Click OK to save the web part settings.

10.
Finally, connect the web part to the BCS Customer web part. To do so, hover over the CustomerID Query String Filter web part header. To the right, click the arrow, select Connections, Send Filter Values To, and select BCS Customer.

11.
In the Configure Connection dialog box, select BCS Customer, and click Finish.

12.
In the Page Ribbon at the top of the SharePoint page, click Stop Editing to complete all changes.

13.
In the address bar of Internet Explorer, change the address removing everything that appears after default.aspx. In its place, type ?CustomerID=1 and press Enter. Notice that the page shows the default data for Orlando Gee and any related orders.

14.
Repeat step 13, but use 61 for the CustomerID. Notice that the data changes to show the customer details and orders for Jeffery Kurtz, as shown in Figure 10.

                                                                          Figure 10. Customer dashboard for Jeffrey Kurtz.


15.
Repeat step 13, and instead use 151. Observe how the data changes again, this time showing the records for Walter Brian.
Other  
  •  Business Intelligence in SharePoint 2010 with Business Connectivity Services : Consuming External Content Types (part 2) - Writing to External Content Types
  •  Business Intelligence in SharePoint 2010 with Business Connectivity Services : Consuming External Content Types (part 1) - External Lists & External Data
  •  Optimizing an Exchange Server 2010 Environment : Analyzing Capacity and Performance
  •  Examining Exchange Server 2010 Performance Improvements
  •  Recovering from a Disaster in an Exchange Server 2010 Environment : Recovering Active Directory
  •  Business Intelligence in SharePoint 2010 with Business Connectivity Services : External Content Types (part 3) - Creating an External Content Type for a Related Item
  •  Business Intelligence in SharePoint 2010 with Business Connectivity Services : External Content Types (part 2) - Defining the External Content Type
  •  Business Intelligence in SharePoint 2010 with Business Connectivity Services : External Content Types (part 1)
  •  Recovering from a Disaster in an Exchange Server 2010 Environment : Recovering from Database Corruption
  •  Recovering from a Disaster in an Exchange Server 2010 Environment : Recovering Exchange Server Application and Exchange Server Data
  •  Recovering from a Disaster in an Exchange Server 2010 Environment : Recovering from a Complete Server Failure
  •  Sharepoint 2007: Add a Column to a List or Document Library
  •  Sharepoint 2007: Create a New Document Library
  •  Sharepoint 2007: Open the Create Page for Lists and Libraries
  •  Exchange Server 2010 : Developments in High Availability (part 3) : Backup and restore
  •  Exchange Server 2010 : Developments in High Availability (part 2) : Configuring a Database Availability Group & Managing database copies
  •  Exchange Server 2010 : Developments in High Availability (part 1) : Exchange database replication & Database Availability Group and Continuous Replication
  •  High Availability in Exchange Server 2010 : Exchange Server database technologies
  •  SharePoint 2010 : Cataloging the Best Scripts to Automate SharePoint Administration
  •  SharePoint Administration with PowerShell (part 2)
  •  
    Top 20
    Installing Exchange Server 2010 : Unattended setup
    Defensive Database Programming with SQL Server : Using TRY...CATCH blocks to Handle Errors
    SQL Azure : Tuning Techniques (part 2) - Connection Pooling & Execution Plans
    Parallel Programming with Microsoft .Net : Dynamic Task Parallelism - An Example
    Configuring Networking for Laptops
    Exchange Server 2010 and Active Directory
    Programming the Mobile Web : Server-Side Browser Detection and Content Delivery - Content Adaptation
    Programming the Mobile Web : Multimedia and Streaming
    Windows Server 2008: Improvements for Thin Client Remote Desktop Services
    Mouse Events in Silverlight
    Android Security : Binder Interfaces
    SQL Server 2008 : Explaining Advanced Query Techniques - Managing Internationalization Considerations
    Work with IIS 7.0 : Delegate Rights Assignments
    Building Your First Windows Phone 7 Application (part 3) - Writing Your First Windows Phone Code
    Windows 7 : Preparing Disks for Use (part 3)
    Windows Server 2008 : Designing Organizational Unit and Group Structure - Exploring Sample Design Models
    Windows Server 2008: Domain Name System and IPv6 - Understanding the Need for DNS
    SQL Azure : Tuning Techniques (part 5) - Provider Statistics & Application Design
    SQL Server 2008 : Service Broker - Message Types
    Windows 7 : Protecting Your Computer While Browsing (part 2) - Viewing and Managing Browsing History