SharePoint の PerformancePoint Services 用のフィルター エディターを作成する

PerformancePoint サービス のカスタム フィルター拡張機能のエディター コンポーネントを作成する方法について説明します。

PerformancePoint サービス のカスタム フィルター エディターとは

PerformancePoint サービス では、カスタム フィルター エディターを使用することにより、ユーザーがカスタム フィルターのプロパティを設定できます。 フィルター エディターでは、フィルターの BeginPoints プロパティも初期化する必要があります。これにより、スコアカードとレポート コンシューマーのパラメーター値を含むフィルター beginpoint が定義されます。 エディターの要件と機能の詳細については、「 カスタム PerformancePoint Services オブジェクトのエディター」を参照してください。

次に示す手順と例は、カスタム オブジェクト サンプルからの SampleFilterEditor クラスに基づいています。 エディターは、ユーザーがフィルターの名前と詳細を変更し、基になるデータ ソースを選択できるシン Web アプリケーションです。 クラスの完全なコードについては、「コード例: SharePoint でカスタム PerformancePoint Services フィルターを作成、取得、更新する」を参照してください。

サンプル エディターをテンプレートとして使用することをお勧めします。 サンプルは PerformancePoint サービス API のオブジェクトを呼び出す方法を示し、リポジトリ操作 (オブジェクトの作成、更新など) の呼び出しを容易にするヘルパー オブジェクトを提供し、PerformancePoint サービス 開発のためのベスト プラクティスを示します。

カスタム PerformancePoint サービス フィルターのエディター クラスの作成と構成

  1. コンピューターに、PerformancePoint サービス をインストールするか、拡張機能で使用する DLL (手順 3 を参照) をコピーします。 詳細については、「 クラス ライブラリを含む DLL」を参照してください。

  2. Visual Studio で、C# クラス ライブラリを作成します。 拡張機能のクラス ライブラリを作成してある場合は、新しい C# クラスを追加します。

    DLL には、厳密な名前で署名する必要があります。 さらに、DLL によって参照されたすべてのアセンブリが厳密な名前を持つことを確認してください。 厳密な名前を使用してアセンブリに署名する方法の詳細、および公開/秘密キーのペアを作成する方法の詳細については、「How to: Create a public/private key pair」を参照してください。

  3. プロジェクトに、アセンブリ参照として以下の DLL を追加します。

    • Microsoft.PerformancePoint.Scorecards.Client.dll
    • Microsoft.PerformancePoint.Scorecards.ServerCommon.dll
    • Microsoft.PerformancePoint.Scorecards.ServerRendering.dll
    • Microsoft.PerformancePoint.Scorecards.Store.dll (ヘルパー クラスが使用)
    • Microsoft.SharePoint.dll (ヘルパー クラスが使用)

    サンプル エディターには、System.Web.dll と System.Web.Services.dll へのアセンブリ参照も含まれます。 拡張機能の機能によっては、その他のプロジェクト参照が必要になることがあります。

  4. サンプルから以下のクラスをプロジェクトに追加します。 エディターは、PerformancePoint サービス リポジトリを操作するためにこれらのヘルパークラスを使用します。

    • DataSourceConsumerHelper.cs
    • ExtensionRepositoryHelper.cs
    • FilterRepositoryHelper.cs
    • IDataSourceConsumer.cs
  5. エディター クラスで、次のPerformancePoint Services名前空間のディレクティブを追加usingします。

    • Microsoft.PerformancePoint.Scorecards
    • Microsoft.PerformancePoint.Scorecards.ServerCommon
    • Microsoft.PerformancePoint.Scorecards.ServerRendering

    拡張機能の機能によっては、他の using ディレクティブが必要になることがあります。

  6. エディターの実装をサポートする基本クラスから継承します。 サンプル フィルター エディターは Web アプリケーションであるため、 Page クラスから継承します。 他の実装では、 UserControl クラス、 WebPart クラスなどの基底クラスから派生できます。

  7. ユーザーが参照または編集するプロパティを公開するコントロールを定義します。 サンプルのフィルター エディターは、ユーザー インターフェイス コンポーネント (ASPX ページ) に定義された Web サーバー コントロールの変数を最初に宣言します。 また、サンプル エディターは、変更をユーザーが送信できるようにするボタン コントロールも定義します。 次に、エディターは CreateChildControls() メソッドを呼び出して、コントロールをページで使用できるようにします。

    注:

    エディターは、ユーザー インターフェイスとは別のプログラミング ロジックを定義します。 エディターのユーザー インターフェイス コンポーネントを作成するための説明は、この文書の範囲外となります。

    サンプルのフィルター エディターは、 Page_Load メソッドで手順 8 ~ 12 を実行します。 Page_Load は、変数とコントロールの初期化と検証、コントロールへのデータの挿入、カスタム フィルターとヘルパー オブジェクトの状態情報の保存にも使用されます。

  8. AllowUnsafeUpdates プロパティを true に設定します。 これにより、フォーム POST 操作を使用しなくても、フィルター エディターでデータをリポジトリに書き込むことができます。

  9. クエリ文字列からパラメーターを取得し、それらを以下のコード例で示すローカル変数のための値として設定します。

    // The URL of the site collection that contains the PerformancePoint Services repository.
    string server = Request.QueryString[ClickOnceLaunchKeys.SiteCollectionUrl];
    
    // The location of the filter in the repository.
    string itemLocation = Request.QueryString[ClickOnceLaunchKeys.ItemLocation];
    
    // The operation to perform: OpenItem or CreateItem.
    string action = Request.QueryString[ClickOnceLaunchKeys.LaunchOperation];
    

    注:

    クエリ文字列パラメーターの詳細については、「カスタム PerformancePoint Services オブジェクトのエディター」を参照してください。

  10. 以下のコード例に示すように、リポジトリを呼び出すための FilterRepositoryHelper オブジェクトを取得します。

    filterRepositoryHelper = new FilterRepositoryHelper();
    
  11. 以下のコード サンプルのように、クエリ文字列パラメーターに基づいてフィルターの場所を設定します。

    RepositoryLocation repositoryFilterLocation = RepositoryLocation.CreateFromUriString(itemLocation);
    
  12. クエリ文字列から実行する操作 ( OpenItemCreateItem) を取得して、カスタム フィルターを取得または作成します。

    • カスタム フィルターを取得するには、 FilterRepositoryHelper.Get メソッドを使用します。
    • カスタム フィルターを作成するには、 Filter() コンストラクターを使用して、フィルターの NameRendererClassName 、および SubTypeId プロパティを定義します。 SubTypeId は、フィルターの一意の識別子であり、PerformancePoint サービス web.config ファイルでカスタム フィルターに指定する subType 属性と一致する必要があります。 RendererClassName は、レンダラーの Web サーバー コントロールを定義するクラスの完全修飾名です。 これをエディターに定義しない場合、この値は、web.config ファイルに指定されたレンダラー クラスに既定設定されます。
    if (ClickOnceLaunchValues.OpenItem.Equals(action, StringComparison.OrdinalIgnoreCase))
    {
      // Use the repository-helper object to retrieve the filter.
      filter = filterRepositoryHelper.Get(repositoryFilterLocation);
      if (filter == null)
      {
        displayError("Could not retrieve the filter for editing.");
        return;
      }
    }
    else if (ClickOnceLaunchValues.CreateItem.Equals(action, StringComparison.OrdinalIgnoreCase))
    {
      filter = new Filter
      {
        RendererClassName = typeof(MultiSelectTreeViewControl).AssemblyQualifiedName,
        SubTypeId = "SampleFilter"
      };
    }
    

    注:

    既定では、ユーザーは PerformancePoint ダッシュボード デザイナーからのみカスタム オブジェクトを作成できます。 ユーザーがダッシュボード デザイナーの外部でカスタム オブジェクトを作成できるようにするには、リポジトリ内のコンテンツ タイプから CreateItem 要求をエディターに送信するメニュー項目を追加する必要があります。 詳細については、「 カスタム PerformancePoint Services オブジェクトのエディター」を参照してください。

  13. リポジトリからフィルターの基になるデータ ソースを取得します。 サンプル フィルター エディターでは 、FilterRepositoryHelper.DataSourceHelper プロパティを使用して DataSourceConsumerHelper.GetDataSource メソッドを呼び出します。これは、リポジトリ内の場所によってデータ ソースを取得するために使用されます。 次のコード サンプルにその例を示します。

    if (!string.IsNullOrEmpty(filter.DataSourceLocation.ItemUrl))
    {
      RepositoryLocation repositoryDatasourceLocation = RepositoryLocation.CreateFromUriString(filter.DataSourceLocation.ItemUrl);
      datasource = filterRepositoryHelper.DataSourceHelper.GetDataSource(repositoryDatasourceLocation);
    }
    
  14. ユーザーがフィルターのデータ ソースを選択できるようにするには、PerformancePoint サービス データ ソースを使用して選択コントロールにデータを挿入します。 サンプル フィルター エディター内の PopulateDataSourceDropDown メソッドは、 DataSourceConsumerHelper.GetDataSourcesBySourceNames メソッドを呼び出して、データ ソースを取得します。 次のコード サンプルにその例を示します。

    // The parameter contains the default server-relative URL to the PerformancePoint Data Connections Library.
    // Edit this value if you are not using the default path. A leading forward slash may not be needed.
    ICollection dataSourceCollection =
    
    filterRepositoryHelper.DataSourceHelper.GetDataSourcesBySourceNames
        ("/BICenter/Data%20Connections%20for%20PerformancePoint/",
             new[] { "WSTabularDataSource", DataSourceNames.ExcelWorkbook });
    

    サンプル フィルター エディターでは 2 種類のデータ ソースのみを取得しますが、このメソッドを変更して他のデータ ソースの種類をサポートしたり、取得するデータ ソースの種類をユーザーに求めたりすることができます。 特定の型のネイティブ データ ソースを参照するには、 DataSourceNames クラスからフィールドを返す SourceName プロパティを 使用します。 カスタム データ ソースを参照するには、データ ソースの SubTypeId プロパティを使用します。これは、データ ソース拡張機能のPerformancePoint Services web.config ファイルに登録されている subType 属性と同じ値です。

    このメソッドを変更する場合は、サンプル フィルターのデータ プロバイダーの GetDisplayDataInternal メソッドで対応する変更を行う必要があります。

  15. BeginPoints プロパティで表されるフィルター beginpoint を 定義します。 これは、フィルター値のソースを定義し、フィルターでデータをスコアカードおよびレポートに送信できるようにするために必要とされます。

    1. ParameterDefinition オブジェクトを作成します。 BeginPoints は、 ParameterDefinition オブジェクトを 1 つだけ含んだ ParameterDefinitionCollection オブジェクトを返します。

    2. フィルターのデータ プロバイダーを指定するには、 ParameterProviderId プロパティをデータ プロバイダーの一意の識別子に設定します。 この値は、データ プロバイダーの GetId() メソッドから返される値に一致する必要があります。

    3. フィルター値のキー識別子のソースを指定するには、 KeyColumn プロパティを、キー識別子を含む表示データ テーブルの列に設定します。 サンプル フィルター エディターでは、このプロパティは、"Symbol" 列として定義されています。

    4. フィルター コントロールの表示値のソースを指定するには、 DisplayColumn プロパティを、表示値を含む表示データ テーブルの列に設定します。 サンプル フィルター エディターでは、このプロパティは、"Symbol" 列として定義されています。

      注:

      表示データ テーブルは DisplayValues プロパティによって返され、フィルター データ プロバイダーが GetDisplayDataInternal メソッドを呼び出すと初期化されます。 データ テーブルに他の列が含まれる場合、他の列マッピングを定義して、追加の機能を提供できます。

    if (0 == filter.BeginPoints.Count)
    {
      ParameterDefinition paramDef = new ParameterDefinition();
    
      // Reference the data provider.
      paramDef.ParameterProviderId = "SampleFilterDataProvider";
      paramDef.DefaultPostFormula = string.Empty;
    
      // Specify the column that contains the key identifiers and the column
      // that contains the display values. The sample uses the same column
      // for both purposes.
      // These values must match the structure of the data table that is
      // returned by the ParameterDefinition.DisplayValues property.
    
      paramDef.KeyColumn = "Symbol";
      paramDef.DisplayColumn = "Symbol";
    
      // You can use this property to store custom information for this filter.
      paramDef.CustomDefinition = string.Empty;
    
      filter.BeginPoints.Add(paramDef);
    }
    

    サンプル エディターでは、その開始ポイントが VerifyFilter メソッドに定義されています。 また、 VerifyFilter を使用して、必要なプロパティが設定されていることが検証され、選択モード (オプションのプロパティ) が定義されています。

  16. フィルターのクエリを実行し、データ ソースからデータを取得して、フィルターを初期化します。 サンプル フィルター エディター内のメソッドが buttonOK_Click メソッドが FilterRepositoryHelper.GetParameterDisplayData メソッドを呼び出して、フィルターを初期化します。

    注:

    エディターは、フィルター オブジェクトを更新する前に、FilterRepositoryHelper.GetParameterDisplayData を 1 回以上呼び出す必要があります。

  17. ユーザー定義の変更を使用してフィルターを更新します。 サンプル フィルター エディター内の buttonOK_Click メソッドは、 FilterRepositoryHelper.Update メソッドを呼び出して、リポジトリ内にあるフィルターの NameDescription 、および DataSourceLocation プロパティを更新します。 また、 buttonOK_Click を使用して、コントロールのコンテンツを検証し、カスタム フィルターとヘルパー オブジェクトの状態情報を取得します。

    注:

    ユーザーは、カスタム オブジェクトの名前説明所有者 (責任者) プロパティを設定し、ダッシュボード デザイナーとPerformancePoint Services リポジトリから直接カスタム オブジェクトを削除できます。

コード例: SharePoint のカスタム PerformancePoint サービス フィルターの作成、取得、更新

以下のコード サンプルでは、カスタム フィルターを作成、取得、および更新します。 このコードは、エディターの分離コード クラスから取られたもので、ASPX ページで定義されるコントロールのプログラミング ロジックとして使用できます。

このコード サンプルをコンパイルできるようにするには、「PerformancePoint Services でのフィルター エディターのエディター クラスの作成と構成」の説明に従って、開発環境を構成する必要があります。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.PerformancePoint.Scorecards;
using Microsoft.PerformancePoint.Scorecards.ServerCommon;
using Microsoft.PerformancePoint.Scorecards.ServerRendering;

namespace Microsoft.PerformancePoint.SDK.Samples.SampleFilter
{

    // Represents the class that defines the sample filter editor.
    public class SampleFilterEditor : Page
    {

        // Declare private variables for the ASP.NET controls defined in the user interface.
        // The sample's user interface is an ASPX page that defines the controls in HTML.
        private TextBox textboxName;
        private TextBox textboxDescription;
        private Label labelErrorMessage;
        private DropDownList dropdownlistDataSource;
        private Button buttonOK;
        private ListBox listboxStocks;

        // Make the controls available to this class.
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            if (null == textboxName)
                textboxName = FindControl("textboxName") as TextBox;
            if (null == textboxDescription)
                textboxDescription = FindControl("textboxDescription") as TextBox;
            if (null == dropdownlistDataSource)
                dropdownlistDataSource = FindControl("dropdownlistDataSource") as DropDownList;
            if (null == labelErrorMessage)
                labelErrorMessage = FindControl("labelErrorMessage") as Label;
            if (null==buttonOK)
                buttonOK = FindControl("buttonOK") as Button;
            if (null==listboxStocks)
                listboxStocks = FindControl("listboxStocks") as ListBox;
        }

        // Handles the Load event of the Page control.
        // Methods that use a control variable should call the Control.EnsureChildControls
        // method before accessing the variable for the first time.
        protected void Page_Load(object sender, EventArgs e)
        {

            // Required to enable custom report and filter editors to
            // write data to the repository.
            ServerUtils.AllowUnsafeUpdates = true;

            // Initialize controls the first time the page loads only.
            if (!IsPostBack)
            {
                EnsureChildControls();
                FilterRepositoryHelper filterRepositoryHelper = null;
                try
                {

                    // Get information from the query string parameters.
                    string server = Request.QueryString[ClickOnceLaunchKeys.SiteCollectionUrl];
                    string itemLocation = Request.QueryString[ClickOnceLaunchKeys.ItemLocation];
                    string action = Request.QueryString[ClickOnceLaunchKeys.LaunchOperation];

                    // Validate the query string parameters.
                    if (string.IsNullOrEmpty(server) ||
                        string.IsNullOrEmpty(itemLocation) ||
                        string.IsNullOrEmpty(action))
                    {
                        displayError("Invalid URL.");
                        return;
                    }

                    // Retrieve the repository-helper object.
                    filterRepositoryHelper =
                        new FilterRepositoryHelper();

                    // Set the filter location.
                    RepositoryLocation repositoryFilterLocation = RepositoryLocation.CreateFromUriString(itemLocation);

                    Filter filter;
                    DataSource datasource = null;

                    // Retrieve or create the filter object, depending on the operation
                    // passed in the query string (OpenItem or CreateItem).
                    if (ClickOnceLaunchValues.OpenItem.Equals(action, StringComparison.OrdinalIgnoreCase))
                    {

                        // Retrieve the filter object by using the repository-helper object.
                        filter = filterRepositoryHelper.Get(repositoryFilterLocation);
                        if (filter == null)
                        {
                            displayError("Could not retrieve the filter for editing.");
                            return;
                        }

                    }
                    else if (ClickOnceLaunchValues.CreateItem.Equals(action, StringComparison.OrdinalIgnoreCase))
                    {

                        // Create a filter.
                        // CreateItem requests can be sent from a SharePoint list, but
                        // you must create a custom menu item to send the request.
                        // Dashboard Designer can send edit requests only.
                        filter = new Filter
                            {

                                // Specify the class that defines the renderer
                                // web server control. The sample filter uses a native
                                // PerformancePoint Services renderer.
                                // Defaults to the value specified in the web.config file
                                RendererClassName = typeof(MultiSelectTreeViewControl).AssemblyQualifiedName,

                                // Specify the unique identifier for the filter.
                                // The SubTypeId property must match the
                                // subType attribute in the web.config file.
                                SubTypeId = "SampleFilter"
                            };
                    }
                    else
                    {
                        displayError("Invalid Action.");
                        return;
                    }

                    VerifyFilter(filter);

                    // Retrieve filter's underlying data source.
                    if (!string.IsNullOrEmpty(filter.DataSourceLocation.ItemUrl))
                    {
                        RepositoryLocation repositoryDatasourceLocation =
                            RepositoryLocation.CreateFromUriString(filter.DataSourceLocation.ItemUrl);
                        datasource =

                            // Gets a PerformancePoint Services data source by using the
                            // DataSourceHelper property to call the
                            // DataSourceConsumerHelper.GetDataSource method.
                            filterRepositoryHelper.DataSourceHelper.GetDataSource(repositoryDatasourceLocation);
                    }

                    // Save the original filter and helper objects across page postbacks.
                    ViewState["action"] = action;
                    ViewState["filter"] = filter;
                    ViewState["filterrepositoryhelper"] = filterRepositoryHelper;
                    ViewState["itemlocation"] = itemLocation;

                    // Populate the child controls.
                    textboxName.Text = filter.Name.ToString();
                    textboxDescription.Text = filter.Description.ToString();

                    // Populate the dropdownlistDataSource control with data sources of specific
                    // types from the PerformancePoint Services repository.
                    // This method looks up the passed data source in the data sources
                    // that are registered in the web.config file.
                    // Although the sample retrieves data sources of two specific types,
                    // you can modify it to prompt the user for a data source type.
                    PopulateDataSourceDropDown(datasource);

                    // Call the SelectedIndexChanged event directly to populate the
                    // listbox control with preview data.
                    dropdownlistDataSource_SelectedIndexChanged(null, null);
                }
                catch (Exception ex)
                {
                    displayError("An error has occurred. Please contact your administrator for more information.");
                    if (filterRepositoryHelper != null)
                    {
                        // Add the exception detail to the server event log.
                        filterRepositoryHelper.HandleException(ex);
                    }
                }
            }
        }

        // Handles the SelectedIndexChanged event of the dropdownlistDataSource control.
        protected void dropdownlistDataSource_SelectedIndexChanged(object sender, EventArgs e)
        {
            EnsureChildControls();

            // Check if a valid data source is selected.
            if (null != dropdownlistDataSource.SelectedItem &&
                !string.IsNullOrEmpty(dropdownlistDataSource.SelectedItem.Text))
            {
                // Retrieve the data source object.
                FilterRepositoryHelper filterRepositoryHelper =
                    (FilterRepositoryHelper)ViewState["filterrepositoryhelper"];
                string selectedDataSourceItemUrl = dropdownlistDataSource.SelectedItem.Value;

                RepositoryLocation repositoryDatasourceLocation =
                    RepositoryLocation.CreateFromUriString(selectedDataSourceItemUrl);
                DataSource datasource = filterRepositoryHelper.DataSourceHelper.GetDataSource(repositoryDatasourceLocation);
                ViewState["datasource"] = datasource;

                // Populate the listboxStocks control with the preview data for the selected
                // data source.
                PopulateListBoxData(datasource);
            }
            else
            {
                ClearStocksListBox();
            }
        }

        // Clears the listboxStocks control.
        // The sample filter works with a web service that provides stock information.
        private void ClearStocksListBox()
        {
            listboxStocks.DataSource = null;
            listboxStocks.DataBind();
            listboxStocks.Items.Clear();
        }

        // Handles the Click event of the buttonOK control.
        protected void buttonOK_Click(object sender, EventArgs e)
        {
            EnsureChildControls();

            // Verify that the controls contain values.
            if (string.IsNullOrEmpty(textboxName.Text))
            {
                labelErrorMessage.Text = "A filter name is required.";
                return;
            }
            if (dropdownlistDataSource.SelectedIndex == 0)
            {
                labelErrorMessage.Text = "A data source is required.";
                return;
            }

            // Clear any pre-existing error message.
            labelErrorMessage.Text = string.Empty;

            // Retrieve the filter, data source, and helper objects from view state.
            string action = (string)ViewState["action"];
            string itemLocation = (string) ViewState["itemlocation"];
            Filter filter = (Filter)ViewState["filter"];
            DataSource datasource = (DataSource)ViewState["datasource"];
            FilterRepositoryHelper filterRepositoryHelper = (FilterRepositoryHelper)ViewState["filterrepositoryhelper"];

            // Update the filter object with form changes.
            filter.Name.Text = textboxName.Text;
            filter.Description.Text = textboxDescription.Text;
            filter.DataSourceLocation = datasource.Location;
            foreach (ParameterDefinition parameterDefinition in filter.BeginPoints)
            {
                parameterDefinition.DisplayName = filter.Name.Text;
            }

            // Initialize the filter. This method runs the filter's query and retrieves preview data.
            filterRepositoryHelper.GetParameterDisplayData(ref filter);

            // Save the filter object to the PerformancePoint Services repository.
            try
            {
                filter.Validate();

                if (ClickOnceLaunchValues.CreateItem.Equals(action,StringComparison.OrdinalIgnoreCase))
                {
                    Filter newFilter = filterRepositoryHelper.Create(
                        string.IsNullOrEmpty(filter.Location.ItemUrl) ? itemLocation : filter.Location.ItemUrl, filter);
                    ViewState["filter"] = newFilter;
                    ViewState["action"] = ClickOnceLaunchValues.OpenItem;
                }
                else
                {
                    filterRepositoryHelper.Update(filter);
                }
            }
            catch (Exception ex)
            {
                displayError("An error has occurred. Please contact your administrator for more information.");
                if (filterRepositoryHelper != null)
                {

                    // Add the exception detail to the server event log.
                    filterRepositoryHelper.HandleException(ex);
                }
            }
        }

        // Displays the error string in the labelErrorMessage label.
        void displayError(string msg)
        {
            EnsureChildControls();

            labelErrorMessage.Text = msg;

            // Disable the OK button because the page is in an error state.
            buttonOK.Enabled = false;
            return;
        }

        // Verifies that the properties for the filter object are set.
        static void VerifyFilter(Filter filter)
        {

            if (null != filter)
            {

                // Verify that all required properties are set.
                if (string.IsNullOrEmpty(filter.SubTypeId))
                {

                    // This value must match the subType attribute specified
                    // in the web.config file.
                    filter.SubTypeId = "SampleFilter";
                }

                if (string.IsNullOrEmpty(filter.RendererClassName))
                {
                    filter.RendererClassName = typeof (MultiSelectTreeViewControl).AssemblyQualifiedName;
                }

                // Define the BeginPoints property so the filter can send a parameter value to
                // scorecards and reports.
                // The value must be from the KeyColumn of the display
                // DataTable object, which is defined in the data provider. The data table is
                // returned by the FilterRepositoryHelper.GetParameterDisplayData method.
                // A filter has one beginpoint only, and it is represented by a
                // ParameterDefinition object. The ParameterDefinition object defines how
                // the filter accesses the data.
                if (0 == filter.BeginPoints.Count)
                {
                    ParameterDefinition paramDef = new ParameterDefinition
                                                       {
                                                           // This value must match the value returned
                                                           // by the data provider's GetId method.
                                                           ParameterProviderId = "SampleFilterDataProvider",

                                                           // Reference the data provider.
                                                           DefaultPostFormula = string.Empty,

                                                           // Specify the column that contains
                                                           // the key identifiers and the column
                                                           // that contains the display values.
                                                           // The sample uses the same column
                                                           // for both purposes.
                                                           // These values must match the structure
                                                           // of the data table that is returned
                                                           // by the ParameterDefinition.DisplayValues property.
                                                           KeyColumn = "Symbol",
                                                           DisplayColumn = "Symbol",

                                                           // You can use this property to store
                                                           // extra information for this filter.
                                                           CustomDefinition = string.Empty
                                                       };
                    filter.BeginPoints.Add(paramDef);
                }

                // Set optional properties. The renderer can return multiple values.
                filter.SelectionMode = FilterSelectionMode.MultiSelect;
            }
        }

        // Populates the dropdownlistDataSource control.
        void PopulateDataSourceDropDown(DataSource filterDataSource)
        {
            EnsureChildControls();

            FilterRepositoryHelper filterRepositoryHelper =
                (FilterRepositoryHelper)ViewState["filterrepositoryhelper"];

            // Retrieve data sources from the repository by using the DataSourceHelper
            // property to call the DataSourceConsumerHelper object.
            // If you modify the types of data source to retrieve, you must make the corresponding
            // change in the filter's data provider.
            // The parameter contains the default server-relative URL to the PerformancePoint Data Connections Library.
            // Edit this value if you are not using the default path. A leading forward slash may not be needed.
            ICollection dataSourceCollection = filterRepositoryHelper.DataSourceHelper.GetDataSourcesBySourceNames("/BICenter/Data%20Connections%20for%20PerformancePoint/",
                new[] { "WSTabularDataSource", DataSourceNames.ExcelWorkbook });
            if (null == dataSourceCollection)
            {
                displayError("No available data sources were found.");
                return;
            }

            // Create a list of name/value pairs for the dropdownlistDataSource control.
            var dataSources = new List<KeyValuePair<string, string>>();
            int selectedIndex = 0;
            int i = 1;
            dataSources.Add(new KeyValuePair<string, string>(string.Empty, string.Empty));

            foreach (DataSource ds in dataSourceCollection)
            {
                dataSources.Add(new KeyValuePair<string, string>(ds.Name.Text, ds.Location.ItemUrl));

                // Check if the entry is the originally selected data source.
                if ((filterDataSource != null) &amp;&amp;
                    (string.Compare(ds.Name.Text, filterDataSource.Name.Text) == 0))
                {
                    selectedIndex = i;
                }
                ++i;
            }

            dropdownlistDataSource.DataSource = dataSources;
            dropdownlistDataSource.DataTextField = "Key";
            dropdownlistDataSource.DataValueField = "Value";
            dropdownlistDataSource.DataBind();
            dropdownlistDataSource.SelectedIndex = selectedIndex;
        }


        // Populate the list box data.
        void PopulateListBoxData(DataSource datasource)
        {
            EnsureChildControls();

            ClearStocksListBox();

            FilterRepositoryHelper filterRepositoryHelper =
                (FilterRepositoryHelper)ViewState["filterrepositoryhelper"];

            // Retrieve the first 100 rows of the preview data from the data source
            DataSet dataSet = filterRepositoryHelper.DataSourceHelper.GetDataSet(100, datasource);

            if (null != dataSet &amp;&amp; null != dataSet.Tables[0])
            {
                listboxStocks.DataTextField = "Symbol";
                listboxStocks.DataValueField = "Value";
                listboxStocks.DataSource = dataSet.Tables[0];
                listboxStocks.DataBind();
            }
        }
    }
}

次の手順

フィルター エディター (必要に応じてユーザー インターフェイスを含む) とデータ プロバイダーを作成した後、「方法: PerformancePoint Services拡張機能を手動で登録する」の説明に従って拡張機能をデプロイします

関連項目