Dundas Chart for SharePoint Send comments on this topic.
Using Parameters in the Data Connection Wizard
See Also

Glossary Item Box

Overview

In Dundas web parts for SharePoint, parameters (or "filters") are provided in the Data Connection Wizard for changing the data displayed based on values passed in from other web parts. This is accomplished using web part connections, which many SharePoint web parts support.

First, you must connect the Dundas web part to a data source that will support parameters. These include an external database or spreadsheet, a site definition list, Excel Services, and the Business Data Catalog. (The last two mentioned are available only in MOSS 2007.)

Once you reach Step 3 of the Data Connection Wizard, you will see a set of parameter controls for filtering the data from your data source. The parameter controls work somewhat differently depending on the type of data source.

Filtering Data using Column Names and Values

If you are connecting to Excel Services or a Site List, in Step 3 of the Data Connection Wizard you will have the option of filtering your data based on column names and values. Expand the Filters section in this step if you wish to apply this type of filtering. Doing so will reveal a set of parameter controls for defining one or more filters. For each filter (one row of controls), you must set the following fields:

  1. Name: Enter the name of a column in your Site List that you wish to filter on.
  2. Type: Choose the correct data type for the column in your Site List.
  3. Operator: Choose a comparison operator, which can be one of: <, >, <=, >=, =, or <>.
  4. Default value: Enter a value to compare with.

Once the filters have been defined, click the Preview Data button to see the resulting filtered data.

Figure 1 below shows an example result after connecting to a Site List and applying a filter to display only entries in which NumStudents is greater than 170.

 

Figure 1: Filtering data from a Site List using a column name and value.

 

If you are connecting to an external database or spreadsheet, in Step 3 of the Data Connection Wizard you will have the option of applying filters based on column (field) names and values by using the Filters set of controls, as shown in Figure 2 below.

 

Figure 2: Filtering data from an external database using a column name and value.

 

Filtering Data using Parameters

If you are connecting to an external database or spreadsheet, in Step 3 of the Data Connection Wizard you will have the option of defining parameters and using them in your query. For example, you might define two parameters in Step 3 and use them in your query as follows:

    SELECT * FROM Sales WHERE Country = @Country AND Category = @Category

It is important to be familiar with the proper use of parameters depending on the data providers you use. The above example will work if you select System.Data.SqlClient in Step 2 of the Data Connection Wizard, for example, to connect to a Microsoft SQL Server database. If you choose this, tips for connection strings can be found in the help under the heading SqlConnection (.NET 2.0).

If you choose System.Data.OleDb or System.Data.Odbc in Step 2 of the Data Connection Wizard, parameters are represented by question marks where the parameter name is not specified. For example:

    SELECT * FROM Sales WHERE Country = ? AND Category = ?

More details for connecting using OLE DB drivers can be found in the SQL Server documentation.

 

Figure 3: Filtering data from an external database using parameters.

 

Setting Parameter Values

Once you have finished with the Data Connection Wizard, you can connect other web parts on your page to the Dundas web part to set the values of the parameters you have just added. These web parts include the Form Web Part, MOSS 2007 filter web parts, and custom web parts that implement the IWebPartField interface.

Parameters can used just with other web parts on the page as shown above, or they can be used to accomplish drill down, where clicking on a data point or other element in your dashboard can filter data based on the element that was clicked. 

 

See Also