共用方式為


PerformancePoint Services Code Sample: Custom Report, Filter, and Tabular Data Source Objects

Learn about the custom report, filter, and data source code examples that are included in the PerformancePoint Services SDK Reference Sample.

The Custom Report, Filter, and Tabular Data Source Objects sample for PerformancePoint Services in Microsoft SharePoint Server 2010 is included in the PerformancePoint Services SDK Reference Sample. The sample is designed to show how to create custom report, filter, and tabular data source extensions for PerformancePoint Services. It contains a data source that retrieves stock quotes from an external web service, a filter that enables users to specify the stocks to show values for, and a report that shows the values of the stocks that are selected in the filter.

We recommend that you use the sample as a template for your custom extensions. The sample contains helper objects that simplify calls for repository operations (such as create and update) and demonstrates best practices for programming with PerformancePoint Services. For more information about supported extension types, see Development Scenarios with PerformancePoint Services.

Applies to: SharePoint Server 2010

Components in the Custom Report, Filter, and Tabular Data Source Objects Sample

The sample contains the following components that pertain to custom objects:

  • Report Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

  • Filter Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

  • Data Source Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

  • Helper Objects in the Custom Report, Filter, and Tabular Data Source Objects Sample

The report, filter, and data source extensions include renderer or provider components and editor components. Renderers are implemented as web server controls, and editors are implemented as ASPX pages with code-behind classes. The sample editors follow the SharePoint Server development practice of defining the editor's programming logic for the ASPX page in a class that is compiled in a DLL.

Note

For instructions about how to install the custom objects from the sample on your development computer, see Installing the Sample Report, Filter, and Data Source Objects.

Report Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

The sample report receives data from the sample filter and displays stock quote information in a table. Custom report extensions typically include a renderer (required) and an editor.

The sample report contains the following files:

  • SampleReportRenderer.cs  Renders the sample report in a Web Part. The renderer is a web server control that uses an HtmlTextWriter object to write the HTML for the report visualization.

  • SampleReportViewEditor.aspx  Provides the editor's user interface, which is an ASPX page that runs on the front-end web server and displays web server controls. The ASPX page defines web server controls in HTML.

  • SampleReportViewEditor.cs  Provides the programming logic for the editor, including the logic for the controls that are defined in the ASPX page.

For more information, see Create Report Extensions for PerformancePoint Services.

Filter Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

The sample filter uses stock quote information retrieved from a web service or Microsoft Excel workbook. Custom filter extensions typically include a provider (required), a renderer, and an editor. A filter can use either a custom renderer or a native PerformancePoint Services renderer. This sample uses the PerformancePoint Services multiselect tree control.

The sample filter contains the following files:

  • SampleFilterDataProvider.cs  Defines the data provider for the custom filter. This class handles the interaction with the filter's data source.

  • SampleFilterEditor.aspx  Provides the editor's user interface, which is an ASPX page that runs on the front-end web server and displays web server controls. The ASPX page defines web server controls in HTML.

  • SampleFilterEditor.cs  Provides the programming logic for the editor, including the logic for the controls that are defined in the ASPX page.

For more information, see Create Filter Extensions for PerformancePoint Services.

Data Source Extension in the Custom Report, Filter, and Tabular Data Source Objects Sample

The sample data source provides stock quote information from a web service. Custom data source extensions typically include a provider (required) and an editor. PerformancePoint Services supports only tabular data sources.

The sample data source contains the following files:

  • BasicTabularDataSourceProvider.cs  Contains the overridden methods that are not implemented by the custom data source provider.

  • SampleDataSourceEditor.aspx  Provides the editor's user interface, which is an ASPX page that runs on the front-end web server and displays web server controls. The ASPX page defines web server controls in HTML.

  • SampleDataSourceEditor.cs  Provides the programming logic for the editor, including the logic for the controls that are defined in the ASPX page.

  • SampleDSCacheHandler.cs  Represents the underlying data source that provides stock quote information. This class retrieves stock values from a cache file and updates it with values that are retrieved from the web service.

  • WSTabularDataSourceProvider.cs  Represents the custom data source provider.

For more information, see Create Tabular Data Source Extensions for PerformancePoint Services.

Helper Objects in the Custom Report, Filter, and Tabular Data Source Objects Sample

PerformancePoint Services uses SharePoint lists as its repository for first class objects (FCOs). It stores data sources in a SharePoint document library, and it stores dashboards, scorecards, reports, filters, key performance indicators (KPIs), and indicators in a SharePoint list. The default repository comprises the PerformancePoint Data Connections Library and the PerformancePoint Content List.

The sample includes helper objects that simplify the required operations between an editor and the PerformancePoint Services repository, such as retrieving and updating custom objects and accessing PerformancePoint Services data sources. Helper objects also provide hooks for server logging and exception handling.

Note

Because the sample editors run on the front-end web server, they use the BIMonitoringServiceApplicationProxy and SPDataStore objects to perform repository operations. For more information, see Editors for Custom PerformancePoint Services Objects.

The following classes from the sample represent helper objects:

  • ExtensionRepositoryHelper.cs  Represents the base class for the repository helper objects.

    • DataSourceRepositoryHelper.cs  Creates, retrieves, and updates custom data source objects in the PerformancePoint Services repository. This class is used by the sample data source editor.

    • FilterRepositoryHelper.cs  Creates, retrieves, and updates custom filter objects in the PerformancePoint Services repository. This class is used by the sample filter editor.

    • ReportViewRepositoryHelper.cs  Creates, retrieves, and updates custom report objects in the PerformancePoint Services repository. This class is used by the sample report editor.

  • IDataSourceConsumer.cs  Represents an interface implemented by the FilterRepositoryHelper and ReportViewRepositoryHelper classes that identifies them as data source consumers.

  • DataSourceConsumerHelper.cs  Accesses and consumes data from underlying data sources. This class is used by the sample report and filter.

Installing the Sample Report, Filter, and Data Source Objects

To install the sample report, filter, and data source objects, you must build the sample assembly, register the assembly in the global assembly cache, copy the editor and style sheet files, and register the extensions in the PerformancePoint Services web.config file. These tasks require sufficient administrative permissions on the application server, which is the computer that is running PerformancePoint Services.

Note

The redirect functionality that opens the custom editors requires that your SharePoint Server 2010 configuration contains a top-level (root) site collection.

Note

Instructions about how to install the complete sample are included with the sample files.

To install the sample report, filter, and data source objects

  1. Download the PerformancePoint Services SDK Reference Sample compressed (.zip) file, which includes the custom report, filter, and tabular data source components.

  2. Extract the contents to a folder on your computer.

  3. Open the sample in Visual Studio.

  4. In Solution Explorer, expand the References folder and restore any missing project references. PerformancePoint Services assemblies are installed to the global assembly cache only. Depending on your development environment, you may have to copy them to a different directory. For instructions about copying PerformancePoint Services assemblies from the global assembly cache, see PerformancePoint Services DLLs Used in Development Scenarios.

    The sample includes references to the following PerformancePoint Services and SharePoint Server 2010 assemblies:

    • Microsoft.PerformancePoint.Scorecards.Client

    • Microsoft.PerformancePoint.Scorecards.DataSourceProviders.Standard

    • Microsoft.PerformancePoint.Scorecards.Server

    • Microsoft.PerformancePoint.Scorecards.ServerCommon

    • Microsoft.PerformancePoint.Scorecards.ServerRendering

    • Microsoft.PerformancePoint.Scorecards.Store

    • Microsoft.SharePoint

  5. Build the sample assembly.

    Note

    These instructions assume that you sign the assembly with the SDKSamples.snk file that is included in the sample. If you use a different strong name key file to generate a public key token for the assembly, replace the sample's public key token in these instructions (fa525c8383a44a52) with the actual key. These instructions also assume that the server-relative URL to the data source repository is /BICenter/Data Connections for PerformancePoint/. If this does not match your configuration, edit the URL in the SampleFilterEditor.PopulateDataSourceDropDown method. Depending on your configuration, the URL may not require a leading forward slash.

  6. On the application server, add the sample assembly (Microsoft.PerformancePoint.SDK.Samples.dll) to the global assembly cache. For instructions, see How to: Install an Assembly into the Global Assembly Cache.

  7. Copy the editor ASPX pages from the SampleDataSource, SampleFilter, and SampleReport folders in the sample files to the LAYOUTS folder in the path %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS.

  8. Copy ppsmasdk.css from the sample files to the STYLES folder in the path %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\STYLES.

  9. Perform steps 1 through 3 in the "To add metadata for a custom report, filter, or data source object" procedure in How to: Manually Register PerformancePoint Services Extensions. This procedure creates a backup copy of the PerformancePoint Services web.config file, and then adds code to support registering custom objects.

  10. To register the sample report, filter, and data source objects, paste the following code into the CustomFCOGroup element.

    <CustomFCO type="DataSource" subType="WSTabularDataSource">
        <Resources FCOName="Custom Data Source" FCODescription="This is my custom data source." />
        <EditorURI uri="/_layouts/SampleDataSourceEditor.aspx" />
    </CustomFCO>
    <CustomFCO type="Filter" subType="SampleFilter">
        <Resources FCOName="Custom Filter" FCODescription="This is my custom filter." />
        <RendererClass name="Microsoft.PerformancePoint.Scorecards.ServerRendering.MultiSelectTreeViewControl, 
        Microsoft.PerformancePoint.Scorecards.ServerRendering, Version=14.0.0.0,
        Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <EditorURI uri="/_layouts/SampleFilterEditor.aspx" />
    </CustomFCO>
    <CustomFCO type="ReportView" subType="SampleReportView">
        <Resources FCOName="Custom Report" FCODescription="This is my custom report."/>
        <RendererClass name="Microsoft.PerformancePoint.SDK.Samples.SampleReport.SampleReportRenderer,
        Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0,
        Culture=neutral, PublicKeyToken=fa525c8383a44a52" />
        <EditorURI uri="/_layouts/SampleReportViewEditor.aspx" />
    </CustomFCO>
    
  11. To register the sample data source provider, paste the following code into the CustomDataSourceProviders element.

    <add key="WSTabularDataSource" value="Microsoft.PerformancePoint.SDK.Samples.SampleDataSource.WSTabularDataSourceProvider,
    
        Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral,
    
        PublicKeyToken=fa525c8383a44a52" />
    
  12. To register the sample filter data provider, paste the following code into the CustomParameterDataProviders element.

    <add key="SampleFilterDataProvider" value="Microsoft.PerformancePoint.SDK.Samples.SampleFilter.SampleFilterDataProvider,
    
        Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral,
    
        PublicKeyToken=fa525c8383a44a52" />
    
  13. Save and then close the web.config file.

  14. Depending on your environment, you may have to restart Internet Information Services (IIS).

After you install the sample, you can use PerformancePoint Dashboard Designer to create instances of the sample data source, filter, and report objects. (Create the sample data source first so you can select it as the data source for the filter. Be sure to click OK in the report editor to initialize the report endpoints and refresh Dashboard Designer to get the updated versions of the custom objects.) Then, add the filter and report to a dashboard, and connect them by selecting Sample Report View EndPoint as the report endpoint and Symbol as the source value for the filter beginpoint. For more information about how to use Dashboard Designer, see the Office website.

See Also

Concepts

Editors for Custom PerformancePoint Services Objects

PerformancePoint Services Code Sample: Custom Scorecard Transforms

Other Resources

Create Report Extensions for PerformancePoint Services

Create Filter Extensions for PerformancePoint Services

Create Tabular Data Source Extensions for PerformancePoint Services