business scorecard builder custom report wp

Upload: fernando-giorgio

Post on 04-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    1/12

    Building Custom Report Viewsfor Microsoft BusinessScorecard Manager 2005

    1

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    2/12

    This is a preliminary document and may be changed substantially prior to finalcommercial release of the software described herein. The information containedin this document represents the current view of Microsoft Corporation on theissues discussed as of the date of publication. Because Microsoft must respond tochanging market conditions, it should not be interpreted to be a commitment onthe part of Microsoft, and Microsoft cannot guarantee the accuracy of anyinformation presented after the date of publication.

    This white paper is for informational purposes only. MICROSOFT MAKES NO

    WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

    Complying with all applicable copyright laws is the responsibility of the user.Without limiting the rights under copyright, no part of this document may bereproduced, stored in, or introduced into a retrieval system, or transmitted in anyform or by any means (electronic, mechanical, photocopying, recording, orotherwise), or for any purpose, without the express written permission ofMicrosoft Corporation.

    Microsoft may have patents, patent applications, trademarks, copyrights, orother intellectual property rights covering subject matter in this document.Except as expressly provided in any written license agreement from Microsoft,the furnishing of this document does not give you any license to these patents,trademarks, copyrights, or other intellectual property.

    2005 Microsoft Corporation. All rights reserved.

    The example companies, organizations, products, domain names, e-mailaddresses, logos, people, places, and events depicted herein are fictitious. Noassociation with any real company, organization, product, domain name, e-mailaddress, logo, person, place, or event is intended or should be inferred.

    Microsoft, MSDN, and the Office Logo are either registered trademarks ortrademarks of Microsoft Corporation in the United States and/or other countries.

    2

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    3/12

    Table of ContentsBuilding Custom Report Views for Microsoft Business Scorecard Manager 2005...................................... .1Building Custom Report Views for Microsoft Business Scorecard Manager 2005...................................... .1

    Table of Contents.................................................................................................................................3

    Introduction............................................................................................................................................. .4Introduction..................................................................................................................................................4

    About Custom Report Views....................................................................................................................4About Custom Report Views........................................................................................................................4

    Creating a Sample Custom Report View..................................................................................................4Creating a Sample Custom Report View................................................................................................. ....4

    Creating the Configuration Component.................................................................................... ............4Creating the Configuration Component....................................................................................................4

    Using the Configuration Component.....................................................................................................8Using the Configuration Component.................................................................................................... ....8

    Creating the Web Component..............................................................................................................9Creating the Web Component..................................................................................................................9

    Using the Web Component.................................................................................................................11Using the Web Component.................................................................................................................. ..11

    3

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    4/12

    IntroductionA core feature of Microsoft Office Business Scorecard Manager 2005 is theability to associate heterogeneous reports with a scorecard or KPI in the form of areport view. These reports provide supplemental data and additional tools to helpdecision makers analyze and act on performance information. BusinessScorecard Manager supports several types of report views, including Office WebComponents (OWC), PivotCharts, PivotTables, spreadsheets, Microsoft SQLServer Reporting Services-based reports, Scorecard Views, and Web pages. Inaddition, developers and third-party Independent Software Vendors (ISVs) canbuild custom .NET-based report view types that seamlessly integrate withBusiness Scorecard Manager. This paper describes the following:

    About Custom Report Views.

    Creating a sample Custom Report View, including:

    Creating the configuration component.

    Using the configuration component.

    Creating the Web component.

    Using the Web component.

    About Custom Report ViewsIn order to create a custom report view, you must build the following twocomponents:

    1. A configuration component, which is hosted in Business Scorecard Builder.

    2. A Web component that is used to display the custom report view hosted on aMicrosoft Windows SharePoint Services-based or Microsoft OfficeSharePoint Portal Server-based Web page.

    The configuration component is a Windows Forms user control that is derivedfrom the CustomReportViewWinControlBase class. This component is shownin the Report View Editor in the Business Scorecard Builder and allows the user toconfigure the custom report view. The custom report view Web component ishosted in the Report View Web Part on a Windows SharePoint Services-based orSharePoint Portal Server-based Web page.

    Creating a Sample Custom Report ViewThis section describes the steps for creating a sample custom report view. Youwill build a component that displays the current state and selection information

    of the scorecard onto the screen.

    Creating the Configuration Component

    The first step in creating the sample custom report view is to create theconfiguration component. The configuration pane of the report view will have atext box you can use to pass data to the Web component and a check box to testthat the validation checking is functioning. You will also add controls for settingthe preferred height and width as well as the report view group, as shown in

    4

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    5/12

    Figure 1 (a group represents the physical areas that are available for displayingreport views in the Report View Web Part on a Windows SharePoint Services-based or SharePoint Portal Server-based Web site).

    Figure 1The completed sample configuration component

    The following is the sample code for the configuration component:

    using System;using System.Windows.Forms;

    using System.ComponentModel;

    using System.Drawing;

    using Microsoft.PerformanceManagement.Scorecards.Client;

    using Microsoft.PerformanceManagement.Scorecards.Extensions;

    namespace CustomReportViewSample

    {

    ///

    /// Sample custom Report View authoring control

    ///

    public class SampleCustomReportViewWinControl : CustomReportViewWinControlBase

    {

    CustomReportView customReportView;

    CheckBox validate = new CheckBox();

    TextBox customDataTextBox = new TextBox();

    ErrorProvider validationErrorProvider = new ErrorProvider();

    ComboBox groupComboBox = new ComboBox();

    TextBox preferredHeight = new TextBox();

    TextBox preferredWidth = new TextBox();

    const int MaxReportViewZones = 30;

    public SampleCustomReportViewWinControl()

    {

    // Add the custom data control

    5

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    6/12

    Label label = new Label();

    label.Left = 10;

    label.Top = 10;

    label.Text = "&Custom Data:";

    label.Height = label.PreferredHeight;

    label.Width = label.PreferredWidth;

    this.Controls.Add(label);

    customDataTextBox.Left = 10;

    customDataTextBox.Top = label.Bottom + 10;

    customDataTextBox.Height = 50;

    customDataTextBox.Width = 200;

    customDataTextBox.Multiline = true;

    this.Controls.Add(customDataTextBox);

    // Add the pass-validation control

    validate.Left = 10;

    validate.Top = customDataTextBox.Bottom + 10;

    validate.Height = 50;

    validate.Width = 200;

    validate.Text = "Pass &validation";

    validate.Checked = true;

    this.Controls.Add(validate);

    // Add the preferred height control

    Label preferredHeightLabel = new Label();

    preferredHeightLabel.Top = validate.Bottom + 10;

    this.Controls.Add(preferredHeightLabel);

    preferredHeightLabel.Text = "Preferred &height:";

    preferredHeightLabel.TextAlign = ContentAlignment.MiddleRight;

    preferredHeight.Top = preferredHeightLabel.Top;

    preferredHeight.Left = preferredHeightLabel.Right + 5;

    preferredHeight.Width = 40;

    this.Controls.Add(preferredHeight);

    preferredHeight.Name = "preferredHeight";

    preferredHeight.MaxLength = 5;

    // Add the preferred width control

    Label preferredWidthLabel = new Label();preferredWidthLabel.Top = preferredHeightLabel.Bottom + 10;

    this.Controls.Add(preferredWidthLabel);

    preferredWidthLabel.Text = "Preferred &width:";

    preferredWidthLabel.TextAlign = ContentAlignment.MiddleRight;

    preferredWidth.Top = preferredWidthLabel.Top;

    preferredWidth.Left = preferredWidthLabel.Right + 5;

    preferredWidth.Width = 40;

    this.Controls.Add(preferredWidth);

    preferredWidth.Name = "preferredWidth";

    preferredWidth.MaxLength = 5;

    // Add the group drop down

    Label groupLabel = new Label();

    groupLabel.Top = preferredWidthLabel.Bottom + 10;

    this.Controls.Add(groupLabel);groupLabel.Text = "&Group:";

    groupLabel.TextAlign = ContentAlignment.MiddleRight;

    for (int i=1; i

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    7/12

    groupComboBox.Top = groupLabel.Top;

    groupComboBox.Height = groupComboBox.PreferredHeight;

    groupComboBox.Width = 40;

    this.Controls.Add(groupComboBox);

    }

    public override void SetCustomReportView(

    CustomReportView customReportView)

    {

    this.customReportView = customReportView;

    customDataTextBox.Text = customReportView.Data;

    if (customReportView.PreferredHeight > 0)

    preferredHeight.Text =

    customReportView.PreferredHeight.ToString();

    if (customReportView.PreferredWidth > 0)

    preferredWidth.Text = customReportView.PreferredWidth.ToString();

    if (customReportView.Zone >= 0 &&

    customReportView.Zone < groupComboBox.Items.Count)

    groupComboBox.SelectedIndex = customReportView.Zone;

    else

    groupComboBox.SelectedIndex = 0;

    }

    public override string GetCustomType(){

    return "SampleCustomReportView";

    }

    public override string GetDisplayName()

    {

    return "Custom Report View Sample";

    }

    public override bool ValidateData()

    {

    if (!validate.Checked)

    {

    // This check is just to demonstrate the validation mechanism

    // In actual code, you would validate your custom data herethis.validationErrorProvider.SetError(

    this.validate,

    "This box must be checked");

    }

    return validate.Checked;

    }

    public override void UpdateData()

    {

    // Update data from UI

    customReportView.Data = customDataTextBox.Text;

    if (preferredHeight.Text.Length > 0)

    customReportView.PreferredHeight = int.Parse(preferredHeight.Text);

    else

    customReportView.PreferredHeight = int.MinValue;

    if (preferredWidth.Text.Length > 0)

    customReportView.PreferredWidth = int.Parse(preferredWidth.Text);

    else

    customReportView.PreferredWidth = int.MinValue;

    customReportView.Zone = groupComboBox.SelectedIndex;

    7

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    8/12

    }

    }

    }

    Using the Configuration Component

    In order to use the configuration component, you must first register it. Then, toverify that it is ready for use, you can check for it in Business Scorecard Builder.

    To use the configuration component

    1. Register the configuration component in the global assembly cache (GAC) onthe server on which Business Scorecard Builder is running. To register it in theGAC, run the following command on the command prompt:

    gacutil /f /i CustomReportViewSample.dll

    2. Register the configuration component with Business Scorecard Builder. To dothis, create a new configuration file named pmbuilder.exe.config in the samefolder as pmbuilder.exe (by default, this is installed to \Program Files\MicrosoftOffice Business Scorecard Manager 2005\Builder). The configuration file for the

    sample report view extension has the following contents:

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    9/12

    Figure 2Custom report view type selection

    The user interface (UI) of the custom report view configuration pane contains atext box to enter an arbitrary string and a check box to test the validationinterface. Clearing the pass-validation check box causes the Business ScorecardBuilder to show an error if the user clicks OK. The contents of the custom datatext box are passed to the custom report view. In an actual implementation, youcan use the CustomData property to pass configuration data to your view

    control, such as in the form of a serialized object.

    Creating the Web Component

    This section describes how to build the view-time component of the customreport view that is used to render content to the user on a Windows SharePointServices-based or SharePoint Portal Server-based Web page. In this sample allthe useful state data that is available to the control at run-time is displayed. Thisdata, which is illustrated in Figure 3, includes:

    1. The custom data set in the authoring component.

    2. The linked scorecard.

    3. The selected Scorecard View.

    4. The selected scorecard node (KpiGroup object).

    5. The selected actual or target (KpiMeasure object).

    7. The active page filters.

    8. The row slice of the selected cell.

    9. The column slice of the selected cell.

    9

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    10/12

    Figure 3Sample custom report view Web control

    Figure 4 shows how the KPIGroupID, the KPIMeasureID,and the Column sliceschange in response to the user selecting a cell.

    Figure 4Sample custom report view Web component with cell selection

    The Web component of the custom report view is derived from theCustomReportViewControlBase class. The following is the sample code forthe report view Web component:

    10

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    11/12

    using System;

    using System.Web;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.ComponentModel;

    using Microsoft.PerformanceManagement.Scorecards.Extensions;

    using Microsoft.PerformanceManagement.Scorecards.Client;

    namespace CustomReportViewSample

    {

    ///

    /// A sample custom report view control

    ///

    public class SampleCustomReportViewControl : CustomReportViewControlBase

    {

    ///

    /// Render this control to the output parameter specified.

    ///

    /// The HTML writer to write out to

    protected override void Render(HtmlTextWriter output)

    {

    // Show the context information available to the control

    output.Write("
    Custom Data: " +HttpUtility.HtmlEncode(this.CustomData));

    output.Write("
    Scorecard Name: " +

    HttpUtility.HtmlEncode(this.ContextData.Scorecard.Name.Text));

    output.Write("
    Scorecard View Name: " +

    HttpUtility.HtmlEncode(this.ContextData.ConfiguredView.Name.Text));

    output.Write("
    selected KpiGroupId: " +

    HttpUtility.HtmlEncode(this.ContextData.SelectedKpiGroupId.ToString()));

    output.Write("
    selected KpiMeasureId: " +

    HttpUtility.HtmlEncode(this.ContextData.SelectedKpiMeasureId.ToString()));

    output.Write("
    Active page filters:");

    output.Write(GetMemberCollectionHtml(this.ContextData.PageFilters));

    output.Write("
    Column slices of the selected cell:");

    output.Write(GetMemberCollectionHtml(this.ContextData.ColumnSlices));

    output.Write("
    Row slices of the selected cell:");

    output.Write(GetMemberCollectionHtml(this.ContextData.RowSlices));

    }

    private string GetMemberCollectionHtml(MemberCollection members)

    {

    string html = "";

    foreach (Member member in members)

    {

    html += "
    " +

    HttpUtility.HtmlEncode(member.UniqueName);

    }

    return html;}

    }

    }

    Using the Web Component

    Before custom report views can be rendered, the Web component extensionmust be registered in the GAC on the server as well as in the web.config file of

    11

  • 7/30/2019 Business Scorecard Builder Custom Report WP

    12/12

    the Windows SharePoint Services-based or SharePoint Portal Server-based Website.

    To use the Web component

    1. Register the Web component in the global assembly cache (GAC) on the serveron which Business Scorecard Manager Server is running. To register it in the

    GAC, run the following command on the command prompt:

    gacutil /f /i CustomReportViewSample.dll

    2. The sample has both the configuration control and the Web control in a singleassembly. To register the component with the Business Scorecard ManagerServer, you must edit the web.config file for the Windows SharePoint Services-based or SharePoint Portal Server-based Web site that hosts the scorecardview pages. As shown in the following code sample, under\, add a new nodenamed Bpm:

    Then, add a section for the custom report view under a new node

    (under ).

    When you build your custom report views, you must change the assemblyreference value and the PublicKeyToken value to that of your assembly.

    You will now be able to see the new sample report view Web componentdisplayed on the Web page alongside other report views.

    12