Share via


How to: Create Data Source Designers

In PerformancePoint Dashboard Designer, a data source designer is used to create and edit a data source object. When the object is selected in the workspace browser, the data source designer connects to the underlying data source through the data source provider component. Then, it populates tabs in the workspace browser with Windows Forms controls that are used to define properties and settings—such as connection information—for the data source object.

The general functionality of the data source designer is defined in the DataSourceFactory class. Typically, this class references other classes, which in turn reference the actual Windows Forms panels that contain the controls.

Note

To add your data source to the Select a Data Source Template dialog box and to optionally provide pages for the New Data Source wizard, you must implement the DataSourceTemplateFactory class. For more information, see How to: Implement the DataSourceTemplateFactory Class.

Implementing the DataSourceFactoryClass

The following procedure shows how to implement the DataSourceFactory class. The complete code example for this class is provided in the Example section.

To implement the DataSourceFactory class

  1. Create the CustomDataSourceFactory class in the Extensions.Dashboard namespace.

  2. Add the following assembly references to your project:

    • System.Drawing.dll

    • System.Windows.Forms.dll

    • Microsoft.PerformancePoint.Scorecards.Client.dll

    • Microsoft.PerformancePoint.Scorecards.Modeler.Framework.dll

    • Microsoft.PerformancePoint.Scorecards.ModelerPlugins.dll

    • Microsoft.PerformancePoint.Scorecards.WizardFramework.dll

    • Microsoft.PerformancePoint.Scorecards.Workspace.dll

    These references apply to the provider component of this custom data source extension. The functionality of your extension determines the references that you add to your project. The default path for Monitoring Server DLLs is drive:\Program Files\Microsoft Office PerformancePoint Server\3.0\Monitoring\Assemblies.

  3. Add the following using directives.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.DataSources;
    
  4. Inherit from the DataSourceFactory class.

  5. Set the SourceName property for the data source. This property must return the same string as the one returned by the GetId method in the data source provider class.

  6. Set the SupportsMicrocubeEditor property for the data source. This property applies only to tabular data sources and relates to the multidimensional mapping feature, which converts tabular data into a fully qualified multidimensional data structure. This example returns false.

    If your implementation supports this feature, your code should return true. You might also need to implement the CreateDataSourceMicrocubeEditor method to provide controls that let users define the multidimensional structure in Dashboard Designer.

  7. To provide controls that enable the data source to be used as the source of KPI values, override the CreateDataSourceMappingEditor method.

  8. To provide controls on the Editor tab, override the CreateDataSourceConnectionEditor method to create an instance of the DataSourceConnectionEditor class. For more information, see Implementing DataSourceConnectionEditor.

  9. To provide editing controls for the multidimensional mapping feature on the View tab, override the CreateDataSourceMicrocubeEditor method. This example does not implement this feature.

  10. To provide time intelligence controls on the Time tab, override the CreateDataSourceTimeIntelligenceEditor method to create an instance of the DataSourceTimeIntelligenceEditor class. For more information, see Implementing DataSourceTimeIntelligenceEditor.

Example

The following code example defines the general functionality of the data source. If the data source supports a feature (such as multidimensional mapping), this class implements the corresponding editor class, which in turn implements the UserControl class that creates the panel containing the actual editing controls.

Prerequisites

Before you compile the code example, ensure you have met the following prerequisites:

  • Install Monitoring Server.

  • Be prepared to sign your DLL with a strong name. In addition, ensure that all assemblies referenced by your DLL have strong names. For information about how to sign an assembly with a strong name and how to create a public/private key pair, see How to: Create a Public/Private KeyPair.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.DataSources;

namespace Extensions.Dashboard
{
    public class CustomDataSourceFactory : DataSourceFactory
    {
        public static string CustomDataSourceName = "CustomDataSource";
        public override string SourceName
        {
            get { return CustomDataSourceName; }
        }

        // Return true for tabular data sources only.
        // If false, the workspace does not display controls that let
        // users apply a multidimensional structure to tabular data.
        // This data source does not implement the multidimensional
        // mapping feature.
        public override bool SupportsMicrocubeEditor
        {
            get { return false; }
        }

        // Create the controls that enable this data source
        // to be used as the source for actual and target KPIs. 
        // Typically, you use the built-in implementation.
        public override DataSourceMappingEditor CreateDataSourceMappingEditor()
        {
            return new DimensionalMappingEditor();
        }

        // Create the editing controls for the Editor tab. 
        // Typically, you implement this method.
        public override DataSourceConnectionEditor CreateDataSourceConnectionEditor()
        {
            return new CustomDataSourceConnectionEditor();
        }

        // If SupportsMicrocubeEditor returns false, do not 
        // implement this method. 
        // This data source does not implement it.
        public override DataSourceMicrocubeEditor CreateDataSourceMicrocubeEditor()
        {
            return null;

            // If your extension returns true for SupportsMicrocubeEditor,
            // you can use the following line to create an 
            // instance of the DataSourceMicrocubeEditor class
            // and then override its members.
            // return new CustomDataSourceMicrocubeEditor();
        }

        // Create the Time Intelligence controls for the 
        // Time tab.
        public override DataSourceTimeIntelligenceEditor CreateDataSourceTimeIntelligenceEditor()
        {
            return new CustomDataSourceTimeIntelligenceEditor();
        }
    } 
}    

Implementing DataSourceConnectionEditor

The following code example provides controls on the Editor tab in which users can enter information about the data source. It creates a Windows Forms panel that inherits from System.Windows.Forms.UserControl, as shown in the "Implementing UserControl" section in How to: Create Report Designers. The previous CustomDataSourceFactory example uses this class when it overrides the CreateDataSourceConnectionEditor method.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.DataSources;
using Microsoft.PerformancePoint.Scorecards.Modeler.Framework.Utilities;
using Microsoft.PerformancePoint.Scorecards;
using System.Windows.Forms;

namespace Extensions.Dashboard
{
    public class CustomDataSourceConnectionEditor : DataSourceConnectionEditor
    {
        // Get the custom panel to display in the Editor tab.
        CustomDataSourcePropertiesPanel panel;

        public CustomDataSourceConnectionEditor()
        {
            panel = new CustomDataSourcePropertiesPanel();
            panel.Dock = DockStyle.Fill;
            this.Controls.Add(panel);
        }

        // This method is called automatically by Dashboard
        // Designer. It sets the controls on your editing
        // panel with values from the data source.
        // As a best practice, you should also maintain a
        // local reference of the data source that is
        // passed in.
        // When a user changes a value in the panel, set the
        // corresponding property on the data source object 
        // so that the changes are maintained when the object is saved
        // or published.
        public override void SetElement(DataSource dataSource, UndoManager undoManager)
        {
            panel.SetElement(dataSource, undoManager);
        }       
    }
}

Implementing DataSourceTimeIntelligenceEditor

The following code example provides controls on the Time tab with which users can select time intelligence settings for the data source. The Windows Forms panel that this class creates inherits from System.Windows.Forms.UserControl. The previous CustomDataSourceFactory example uses this class when it overrides the CreateDataSourceTimeIntelligenceEditor method.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.DataSources;
using Microsoft.PerformancePoint.Scorecards.Modeler.Framework.Utilities;
using Microsoft.PerformancePoint.Scorecards;
using System.Windows.Forms;

namespace Extensions.Dashboard
{
    public class CustomDataSourceTimeIntelligenceEditor : DataSourceTimeIntelligenceEditor
    {
        // Get the built-in panel for the Time tab that contains
        // time intelligence controls for tabular data sources.
        private TabularTimeIntelligencePanel panel;

        public CustomDataSourceTimeIntelligenceEditor()
        {
            this.panel = new TabularTimeIntelligencePanel();
            this.panel.Dock = DockStyle.Fill;
            base.Controls.Add(this.panel);
        }

        public override void SetElement(DataSource dataSource, UndoManager undoManager)
        {
            this.panel.SetElement(dataSource, undoManager);
        }
    }
}

Next step for creating a data source designer: Create the template class factory, as described in How to: Implement the DataSourceTemplateFactory Class.

See Also

Tasks

How to: Install Data Source Designer Extensions

Concepts

How to: Create Data Source Providers

Other Resources

Data Sources