Logo
CAR REVIEW
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

SharePoint 2010 PerformancePoint Services : Working with the Monitoring API - Custom Objects and Editors

5/17/2011 11:24:18 AM
You can create customized objects that live within the PPS world, are available from within Dashboard Designer, and can interact with or supply data to other PPS objects. This proves useful in the following three cases, for example:
  • Creating a custom tabular data source and having the data source used in KPIs, scorecards, and filters

  • Creating a custom report type and linking it on a dashboard with a filter

  • Creating a custom filter that does not depend on a data source like native PPS filters do


Creating a Custom Tabular Data Source

You can create custom tabular data sources for data sources to be used in PPS filters, KPIs, and scorecards. The three steps to creating and using a custom tabular data source are as follows:

1.
Create a signed class library for the custom tabular data source provider.

Note

The signing is necessary to generate a strongly named assembly and class that will later be used when deploying to SharePoint.

2.
Create an editor for custom tabular data source objects.

3.
Deploy the data source and its associated editor by modifying the web.config file, adding necessary files to the GAC, and deploying .aspx files to the layouts folder.

After you complete these steps, the custom tabular data source shows up as an available data source within Dashboard Designer and is usable just like tabular data sources that ship with PPS, such as SQL tables and SharePoint lists.

Caution

PPS supports only tabular custom data source providers. You cannot create a multidimensional or OLAP custom data source provider.


Creating a Class Library for the Custom Tabular Data Source Provider

Custom tabular data source providers must implement the Microsoft.PerformancePoint.Scorecards.DataSourceProviders.TabularDataSourceProvider abstract class. The first step to create a custom tabular data source provider is to create a new class library project in Visual Studio. In this example, we create a simple example custom tabular data source that reads files from a directory.

Caution

Make sure to set the Target framework of the project to .NET Framework 3.5 or lower. If you set the target framework to .NET 4.0, PPS cannot discover this assembly in the GAC at runtime.


You can have multiple custom tabular data sources or other custom objects defined in this one assembly. Create a new CS class file with these using statements at the top.

using Microsoft.PerformancePoint.Scorecards;
using Microsoft.PerformancePoint.Scorecards.DataSourceProviders;

A friendly name set in the web.config file controls what the end user sees, so you can call your class name whatever you would like. Ensure it inherits from the TabularDataSourceProvider class:

public class FileSystemDataSource : TabularDataSourceProvider

Several methods need to be overridden. The order they appear in the class does not matter:

  • GetId method

  • IsConnectionStringSecure property

  • Validate method

  • SetDataSource method

  • GetDataSet method

  • GetDatabaseNames method

  • GetCubeNames method

  • GetCubeNameInfos method

  • GetCubeMetadata method

GetId Method

The GetId method contains the unique identifier in a string format. The string value that this method returns is used later when modifying the web.config file. In most cases, it is sufficient to return a hardcoded string like this:

public override string GetId()
{
return "FileSystemDataSource";
}

SetDataSource Method

The SetDataSource method defines the Dimensions and Fact columns available in this data source. This is roughly equivalent to the column definition user interface (UI) available when editing a PPS-supplied data source, such as a SQL table or SharePoint list, as the same options are available for each column. In this example, we define three columns: two dimension columns named Name and Type, which contain the filename and file extension, respectively, and a fact column that contains the file size:

Note

This method is called frequently. For great performance optimization, configure this method only if it is not already configured for the data source.


public override void SetDataSource(DataSource dataSource)
{
base.SetDataSource(dataSource);

// We only want to define column mappings if they haven't already been defined
if (dataSource.DataTableMapping.ColumnMappings.Count <= 0)
{
dataSource.DataTableMapping.ColumnMappings.Add(new DataColumnMapping
{
SourceColumnName = "Name",
FriendlyColumnName = "Name",
UniqueName = "Name",
ColumnType = MappedColumnTypes.Dimension,
FactAggregation = FactAggregations.None,
ColumnDataType = MappedColumnDataTypes.String
});

dataSource.DataTableMapping.ColumnMappings.Add(new DataColumnMapping
{
SourceColumnName = "Type",
FriendlyColumnName = "Type",
UniqueName = "Type",
ColumnType = MappedColumnTypes.Dimension,
FactAggregation = FactAggregations.None,
ColumnDataType = MappedColumnDataTypes.String
});

dataSource.DataTableMapping.ColumnMappings.Add(new DataColumnMapping
{
SourceColumnName = "FileSize",
FriendlyColumnName = "FileSize",
UniqueName = "FileSize",
ColumnType = MappedColumnTypes.Fact,
FactAggregation = FactAggregations.Sum,
ColumnDataType = MappedColumnDataTypes.Number
});
}
}


GetDataSet Method

The GetDataSet method is the method that actually does the work. We need to create a DataSet that matches the column schema that SetDataSource defines. After that DataSet object is created, it is necessary to fill the rows in the table with the correct data before finally returning the DataSet object:

Tip

This implementation uses a property inherited from the TabularDataSourceProvider base class named DataSource.CustomData. The CustomData field is the preferred mechanism to store user supplied data and is available as a field to change when implementing a custom tabular data source editor.

Depending on what type of data source you want to implement, it might be necessary to store data here in XML or otherwise delimited format if there are multiple values that a user would need to supply to the data source.


public override DataSet GetDataSet()
{
DataSet myDataSet = new DataSet();
DataTable myTable = myDataSet.Tables.Add();

myTable.Columns.Add("Name", typeof(string));
myTable.Columns.Add("Type", typeof(string));
myTable.Columns.Add("FileSize", typeof(int));

foreach (string filePath in Directory.GetFiles(DataSource.CustomData))
{
FileInfo oneFile = new FileInfo(filePath);
DataRow oneRow = myTable.NewRow();
oneRow["Name"] = oneFile.Name;
oneRow["Type"] = oneFile.Extension;
oneRow["FileSize"] = oneFile.Length;
myTable.Rows.Add(oneRow);
}

return myDataSet;
}

Several other methods also need to be implemented to allow successful compilation. These methods are all not used in any fashion in PPS, so they can all throw NotImplementedExceptions:

Tip

The IsConnectionStringSecure method is a carryover from PPS 2007, and given the new extensibility model is deprecated.

The other methods are inherited from the CustomDataSourceProvider class, which is a base class for the TabularDataSourceProvider class. It is a bug in PPS where these methods should not be virtual methods in the TabularDataSourceProvider class. These methods would be called in the case of a custom multidimensional data source, which is not supported in PPS 2010.


public override bool IsConnectionStringSecure
{
get { return false; }
}
public override void Validate()
{
throw new NotImplementedException();
}

public override string[] GetDatabaseNames()
{
throw new NotImplementedException();
}

public override string[] GetCubeNames()
{

throw new NotImplementedException();

}

public override NameInfoCollection GetCubeNameInfos()
{
throw new NotImplementedException();
}

public override Cube GetCubeMetaData(bool extendedMetadata)
{
throw new NotImplementedException();
}


Signing the Assembly

If you use Visual Studio 2010, you can easily assign the assembly. View the properties of the Class Library project, and in the Signing tab create a new strong name key file or select an existing one from the list. Figure 1 shows what this looks like.

Figure 1. A strong name key file is selected in the project properties for the assembly example.
Other -----------------
- SharePoint 2010 PerformancePoint Services : Working with the Monitoring API - Working with PPS Objects
- BizTalk 2010 Recipes : EDI Solutions - Subscribing to EDI Promoted Properties
- BizTalk 2010 Recipes : EDI Solutions - Creating Custom EDI Pipelines
- Monitoring Exchange Server 2010 : Monitoring Mail Flow (part 3) - Managing Messages
- Monitoring Exchange Server 2010 : Monitoring Mail Flow (part 2) - Monitoring Transport Queues
- Monitoring Exchange Server 2010 : Monitoring Mail Flow (part 1) - Configuring Message Tracking
- BizTalk 2010 Recipes : EDI Solutions - Configuring EDI Validation with Pipelines
- BizTalk 2010 Recipes : EDI Solutions - Configuring Automatic Acknowledgements
- Windows Server 2003 : Planning a Backup Strategy
- Windows Server 2003 : Monitoring Network Servers
- Monitoring Exchange Server 2010 : Monitoring Exchange Databases (part 2) - Monitoring DAGs
- Monitoring Exchange Server 2010 : Monitoring Exchange Databases (part 1) - Monitoring Exchange Database Information and Statistics
- Exchange Server 2010 : Configuring Transport Servers - Edge Transport Servers
- BizTalk 2010 Recipes : EDI Solutions - Configuring an EDI Envelope
- BizTalk 2010 Recipes : EDI Solutions - Creating and Configuring a Trading Partner
- SharePoint 2010 PerformancePoint Services : Working with the Monitoring API - Setting Up Your Development Environment
- SharePoint 2010 PerformancePoint Services : Installing SharePoint on a Client Operating System
- Exchange Server 2010 : Configuring Transport Servers - Hub Transport Servers (part 2)
- Exchange Server 2010 : Configuring Transport Servers - Hub Transport Servers (part 1)
- BizTalk 2010 Recipes : EDI Solutions - Defining Complex Mappings in External XSLT
 
 
Most view of day
- Exchange Server 2007 : Leveraging the Capabilities of the Outlook Web Access Client - Getting to Know the Look and Feel of OWA 2007
- Microsoft Systems Management Server 2003 : Security - Accounts and Groups
- Windows Phone 7 Programming Model : Web Browser Control
- Preparing Windows PE : Exploring Windows PE
- Windows Phone 8 : Messaging - Composing a New Message (part 5) - Setting Message Priority
- SQL Server 2012 : XML and the Relational Database - Querying XML Data Using XQuery (part 2) - SQL Server XQuery in Action, XML DML
- Windows Phone 7 : The Silverlight Controls (part 3) - Line, Polyline, and Polygon Controls
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Setting Add-in Security Options
- SharePoint 2010 : Configuring Search Settings and the User Interface - Web Parts (part 1)
- Microsoft Systems Management Server 2003 : Analysis and Troubleshooting Tools - Using SMS Trace (part 2)
Top 10
- Sharepoint 2013 : SharePoint Designer 2013 (part 2) - Locking Down SharePoint Designer
- Sharepoint 2013 : SharePoint Designer 2013 (part 1) - New Features
- Sharepoint 2013 : Branding with the Design Manager (part 2) - Creating a Brand
- Sharepoint 2013 : Branding with the Design Manager (part 1)
- Sharepoint 2013 : SharePoint Designer and Branding - SharePoint 2013 User Interface
- Sharepoint 2013 : Microsoft Office Integration and Office Web Applications - Office Web Applications
- Windows Phone 8 : Scheduled Tasks - Scheduled Task API Limitations
- Windows Phone 8 : Scheduled Tasks - Updating Tiles Using a Scheduled Task Agent
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 5) - Editing an Existing To-Do Item
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 4) - Creating the To-Do Item Shell Tile, Saving a To-Do Item
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro