Friday, November 16, 2018

Connect data in Web Parts

Connect data in Web Parts

In many products and technologies, connecting sets of data from different data sources is challenging and requires programming skill. However, you can use the menus and buttons within a Web Part to create data connections without writing any custom code. For example, by connecting Web Parts, you can present data from two Web Parts in alternate views, perform related calculations between two Web Parts, and filter a Web Part by using values from another Web Part  — all on one Web Part Page.

In this article

Overview of Web Part connections

Create Web Part connections

Create or change a connection between two Web Parts

Complete a Web Part connection in the Configure Connection dialog box

Remove a connection between two Web Parts

Common types of Web Part connections

Overview of Web Part connections

By using Web Part connections, you can create or enhance your Web Part Pages. You connect Web Parts so that when you perform an action in one Web Part, it changes the contents of another Web Part.

For example, you can connect an Employees List View Web Part to the Image Web Part by passing data between the two Web Parts. Each time you select a row in the Employees List View Web Part that contains a column with a picture of that employee, you can see the picture displayed in the Image Web Part.

Basic Web Part connection

1. A Web Part connection is a way to pass data from one Web Part to another Web Part and synchronize their behavior.

2.  One Web Part provides the data.

3. Data can be lists, rows, cells, or parameter values.

4. The other Web Part gets the data.

You can create the Web Part connection from either Web Part by using the connection type submenu from the Connections command on the Web Part menu. For example, if one Web Part's connection type submenu command says Provide Row To, the other Web Part's connection type submenu command says Get Row From.

Not only can you create Web Part connections on the same Web Part Page, but you can also create connections between Web Parts on two different Web Part Pages in the same top-level site by using a Web design program that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer 2007.

Top of Page

Create Web Part connections

Creating a Web Part Page with Web Part connections is a three-step process.

Step 1: Decide what data you want available on the Web Part Page

Often, there are one or more List View Web Parts that provide the data that you want. Lists present your data in a tabular format and make it easy to modify and refresh data, change the sort order, filter within the list, and aggregate data. By using the view selector in the tool pane, you can change the view of a List View Web Part, to work with just the columns that you need.

Step 2: Add the Web Parts to the Web Part Page

Most lists are available as List View Web Parts in your site Web Part gallery. Other Web Parts are usually available in other Web Part galleries that you have access to. Sometimes, you may need to import a Web Part from another site that has an interesting or useful instance of a Web Part. You can also search for Web Parts on external Web sites and then request that they be installed on your Web site by your site administrator. For example, you can find Web Parts in the Microsoft Office SharePoint Server 2007 Web Component Directory or on a Web site from another software manufacturer. Over time, your Web Part galleries will grow and adapt to your needs and the needs of your organization.

Step 3: Connect the Web Parts to get the results you want

You can create connections only between Web Parts that support Web Part connections. Web Parts that support Web Part connections include the List View Web Part, Form Web Part, and Image Web Part. The Connections submenu on the Web Part menu displays only the type of connection that you can create, and the available Web Parts submenu displays only compatible Web Parts. After you complete steps 1 and 2, decision-making is simple and no knowledge of scripting or coding is required to make the Web Part connection.

Note: You can create connections only between Web Parts that are on the same Web Part Page. To connect a Web Part to data from another site or data source, you add a data view by using a Web design program that is compatible with Microsoft Windows SharePoint Services, such as Office SharePoint Designer 2007.

Top of Page

Create or change a connection between two Web Parts

By using menus and dialog boxes, you can connect Web Parts, pass data between them, and synchronize their behavior.

  1. Open the Web Part Page.

  2. On the Site Actions menu Button image , click Edit Page.

  3. Decide which two Web Parts you want to connect. You can create or change the same connection by starting from either Web Part.

  4. From either one of the Web Parts, click the Web Part menu Web Part menu , point to Connections, point to the type of connection that you want to create or change, such as Provide Row To or Get Sort/Filter From, and then click the name of the Web Part for which you want to create or change a connection.

    Key to commands on the Connections submenu

    Command on the Connections submenu

    Description

    Provide Row To

    You can connect the List View Web Part to another Web Part by passing a selected row of data to the other Web Part. Depending on how the other Web Part was created and gets the data, the other Web Part might display the row data or use the row data as a filter or parameter value.

    In standard view, a Select Item column containing option buttons is automatically added when you connect the List View Web Part, so that you can indicate which row to pass to the other Web Part. You can select only one row at a time in standard view. Some columns, such as the Edit column, are not available for use in a Web Part connection.

    In datasheet view, you can select multiple rows, but only one row is passed to the other Web Part. If multiple rows are selected, the row containing the active cell is passed to the other Web Part, and all other rows are ignored. You cannot provide data in the Total row or New row to the other Web Part.

    With this type of connection, you can have more than one Web Part connected to the List View Web Part.

    Provide Data To

    You can connect the List View Web Part to another Web Part that works with list data. In this case, the List View Web Part is the data source for the other Web Part.

    In standard and datasheet view, only the data in the view is provided to the other Web Part.

    With this type of connection, you can have more than one Web Part connected to the List View Web Part.

    Get Sort/Filter From

    In standard and datasheet view, you can connect the List View Web Part to another Web Part that can provide the following information to it:

    1. One or more column name and value pairs of data that filter data in the List View Web Part.

    2. A column of data to sort data by either ascending or descending order in the List View Web Part.

    With this type of connection, only one other Web Part can be connected to the List View Web Part.

    The Web Part menu may not be enabled or visible on your Web Part Page for several reasons, including that the Web Part or the zone does not support connections, you are using a browser that is not compatible with Windows SharePoint Services, or connections are disabled on your site.

  5. For some Web Part connections, you might need to select additional information in the Configure Connection dialog box. For example, you might need to select the connection type that you want to use or a column that you want to filter. Also, depending on how one or both of the Web Parts were created, you may see additional dialog boxes that are unique to the Web Part connection. For more information, see the Help information, if any, for the custom Web Part.

    Tip: You can hide a Web Part if you want to use it to provide data to another Web Part through a Web Part connection, but you don't want to display the Web Part.

    Notes: 

    • The connection type submenu can vary from Web Part Page to Web Part Page and from Web Part to Web Part for several reasons, including differences among the property settings for the Web Part Page, Web Part, or Web Part zone, the type or compatibility of Web Parts on the page, and whether the Web Parts have compatible connection types.

    • Only Web Parts that can be connected appear on the available Web Parts submenu. Some Web Parts on the Web Part Page may not be designed to make connections, some Web Parts may not support connections to the current Web Part, or certain connection limits may currently be exceeded.

Top of Page

Complete a Web Part connection in the Configure Connection dialog box

You use the Configure Connection dialog box to match columns between the Web Part that gets the data and the Web Part that provides the data.

Note:  You can make a connection that is correct, but not meaningful. For example, the Web Part that provides the data may have a product ID column and the Web Part that gets the data may have an employee ID column. Although you can match these columns, the results will not make sense.

In the Column list box, select a column from the Web Part that gets the data, the Web Part that provides the data, or both.

The following are common examples:

  • Matching a row of data in one Web Part to a cell or field of data in another Web Part    

    The Web Part that you are connecting from is a Contacts List View Web Part. One of the columns in the list view is a column that contains a hyperlink called Photo, which contains a URL to a picture of the contact. You make a connection to the Image Web Part, which can display only a URL that contains a picture. You need to choose the Photo column from the Contacts Web Part to provide the correct match to the Image Web Part.

  • Matching a row of data in one Web Part to a column of data in another Web Part so that you can filter it    

    The Web Part that you are connecting from is a List View Web Part that contains order data. One of the columns in the list view is a column that contains a line item called OrdersDetailsID. You make a connection to another List View Web Part that has several columns that contains order details, one of which is a matching column called OrdersDetailsID. To connect the two Web Parts so that when you select the order in one Web Part, it displays each line item for that order in the other Web Part, you must match the OrdersDetailsID columns in each Web Part.

    Note: The column names do not have to be the same, but the underlying data must match or have the same value.

Top of Page

Remove a connection between two Web Parts

  1. Open the Web Part Page.

  2. On the Site Actions menu Button image , click Edit Page.

  3. From either one of the Web Parts from which you want to remove the connection, click the Web Part menu Web Part menu , point to Connections, point to the type of connection that you want to remove — for example, Provide Row To or Get Sort/Filter From — and then click the name of the Web Part from which you want to remove a connection.

    Note: A check mark appears on the connections submenu for each selection that has a connection enabled. If you do not see a check mark, no connection is enabled.

  4. In the Configure Connection dialog box, click Remove Connection.

  5. When you are prompted to confirm that you want to remove the connection between Web Parts, click OK.

Top of Page

Common types of Web Part connections

There are many ways to combine and connect Web Parts on a Web Part Page. You can create several of these Web Part connections on your Web Part Page. The following scenarios describe common types of data connections between Web Parts.

Master and details

You have a master list of data and you need to display detailed information related to this master list.

Master and details example

1.  An Employee Basics Web Part contains basic, commonly accessed employee data, such as ID, name, and job title.

2.  To look up employee details, you select a row.

3.  The row is passed to the other Web Part.

4.  In the Employee Details Web Part, all the employee details are displayed in a form view.

In a List View Web Part, you can even sort and filter a large list to help find the employee before you select the row. If the detail data is extensive, you can even display the Employee Details Web Part on another Web Part Page.

Summary and details

You have a summary list of data and you need to display the detailed information that produces the summary data.

Summary and details example

1.  A Year-to-Date Pay Stub Web Part contains your compensation information.

2.  You select the summary information about your accumulated vacation time and sick days.

3.  The summary information is passed to the other Web Part.

4.  In the Pay Stub Details Web Part that displays weekly data, you verify the weeks when you recorded those days in order to refresh your memory or confirm their accuracy.

Parent and child

You display a list of data (the parent), and for each row there is one or more related rows (the children) that you want to display in another list.

Parent and child example

1.  An Orders Web Part provides a list of the most recent customer orders.

2.  You click the row that contains the order that you want to examine.

3.  The row is passed to the other Web Part.

4.  In the Order Details Web Part, all the line items for that order are displayed.

Search and filter

You want to enter data, such as search or filter criteria, in one Web Part to display the results in another Web Part.

Search and filter example

1.  In the Book Search Web Part, you enter the book information, such as title, author, and subject, to try to find the book or set of books.

2.  You click SUBMIT.

3.  The search criteria are passed to the other Web Part.

4.  The Book List Web Part displays one or more books that match your search criteria.

Calculations

Although you can often calculate data inside a Web Part, sometimes you may want to combine two Web Parts to make your calculations more flexible.

Calculations example

1.  You enter mortgage numbers into a Mortgage Numbers Web Part.

2.  You click GO.

3.  The mortgage numbers are passed to the other Web Part.

4.  The Mortgage Calculator Web Part computes the mortgage and displays the monthly payment schedule.

Alternate data views

Viewing your data in several different ways can help you to understand implications, trends, and relationships. You can pass lists, rows, and cells (or fields and parameters) from one Web Part and display the data in an alternate view.

An alternate view of a list

You want to display all company employees in a hierarchy chart.

Alternate view of list data

1.  The Employees Web Part displays the employee ID, employee name, job title, and manager ID of everyone who works for your company.

2.  Because you are using all the data, no selection is required.

3.  All the data is passed to another Web Part.

4.  The Organization Chart Web Part displays the working relationships between employees and can display alternate views of this hierarchy.

An alternate view of a row

You want to view a row of demographic data in a chart, such as a pie chart or bar graph.

Alternate view of row data

1.  A Population Statistics Web Part displays demographic data such as age, income, and heritage.

2.  You select a row of demographic data.

3.  You pass the data to another Web Part.

4.  The Chart Web Part displays the row of data in a pie chart and alternatively a bar graph.

An alternate view of a cell

You want to track the overall progress of a fund-raising drive.

Alternate view of cell data

1.  In a Fund-Raising Web Part, each member of a group enters the amount of money he or she raised.

2.  The current total is displayed in a total field.

3.  The total field is passed to the other Web Part.

4.  You check your group's overall progress in the Charity Goal Web Part.

Data enhancement

You want to augment basic data about people and places to make it more interesting, appealing, and useful.

Data enhancement example

1.  A Contacts Web Part displays information that you need to keep track of business associates, such as name, address, and perhaps a photo.

2.  You select a contact.

3.  A row of data is passed to the other Web Part.

4.  You see a photo of the contact displayed in the Image Web Part and then locate the contact's business address in a Map Web Part.

Top of Page

No comments:

Post a Comment