Thursday, October 22, 2009

Customizing Report Parameters for Team Foundation Server 2010

Very often you’ll want to change the default settings for parameters in a report, but Reporting Services doesn’t have a user interface that allows you to select parameters, and then save them for use again. There is a way to customize the set of parameter values without learning how to author reports, but it’s a little involved. In this post, I’ll cover the following:

  • Changing the default values that are used to render a report
  • Creating multiple views on the same report, each with different default parameters

About Report Parameters

First a little bit of background on report parameters. Many of the TFS 2010 reports read from the Analysis Services database (or cube) that, by default, is called Tfs_Analysis (it was called TfsWarehouse in previous releases). Since this is a cube, and not a relational warehouse, default parameter values will look a little odd. As an example, this is what the default value might look like when you want to select “Iteration 1” in the iteration parameter:

[Work Item].[Iteration Hierarchy].[Iteration1].&[10]&[11]

Yikes, you say, how are you supposed to figure that out?

I’m not going to get into the details of why this is so complicated. If you’re interested, I wrote an MSDN article for TFS 2008 that will give you some idea about how this works, although the details have changed since then.

But there is a tool you can use to get this information: SQL Server Management Studio, which you can install from the SQL Server DVD. Alternatively, you can use a free program called MDX Studio, which is what I’ll use here as an example.

Finding the Default Value

The first step is to launch MDX Studio and connect to the TFS cube. You might need to find out the server and database from your TFS administrator, and also have them grant you read access (they need to add you to the TfsWarehouseDataReader role).

Finding an Iteration Value

  1. Launch MDX Studio, type the name of the Analysis Services machine into the Connect to Analysis Services dialog box, and then click on the Connect button. You should see a display something like this:
    MDXStudio
  2. In the Metadata section, scroll down so you can see Work Item and expand that item.
  3. Expand the Work Item.Iteration Hierarchy node.
  4. Expand the (All) and then All nodes, and then the collection node that contains your team project.
  5. Expand the node that contains your team project. You should see something like this:
    Iteration1
  6. Finally, drag the iteration node (Iteration 1 in this example) into the Query area:
    IterationMDX

You can now copy this “ID” and use it in the following steps.

Setting Parameter Defaults

You’ll be using Report Manager to make these changes:

  1. Right click on the Reports node of your team project inside Visual Studio and select Show Report Site…:
    ShowReportSite 
  2. Click on the Properties tab at the top of the report:
     PropertiesButton
  3. Click on the Parameters link:
    ParametersLink

At this point you’ll see a list of parameters, which should look something like this:

Parameters

To change the default iteration, for example, you would paste the value you got from the previous step into the text box circled in red above, and then click on the Apply button.

Multiple Parameter Settings – Linked Reports

There are times where you’ll want to have several versions of the report, each with different parameter values. Reporting Services has a feature called Linked Reports that allows you to essentially create sets of parameters that will be applied to a single copy of the report, but appear as a new report.

Here is how you create a linked report:

  1. Click on the Properties tab for the report (just like in the previous section)
  2. Click on the Create Linked Report button on the Properties page
  3. Type in the name you want to use for this new linked report, and then click on the OK button
  4. Click on the Properties tab of this new linked report
  5. Click on the Parameters link on the left side to customize the parameter values that will be used for the linked report, and click on the Apply button to accept the new default values

1 Comments:

At 2/17/10 12:23 PM, Blogger Shane said...

I downloaded:
Microsoft® Visual Studio® 2010 and Team Foundation Server® 2010 Beta 2for Microsoft® Virtual PC 2007 SP1 Image

When I go into the default installation of TFS project site in Sharepoint
(http://vs2010beta2/sites/DefaultCollection/IBuySpy/Dashboards/ProjectDashboard_wss.aspx)

I get this error on the webparts.

There are no accessible team projects in this Team Project Collection. Contact your Team Foundation Server administrator.

In the Team Server Admin Console - Team Project Collection - Team Projects tab the projects are there. This is the default installation. Any suggestions???

 

Post a Comment

Links to this post:

Create a Link

<< Home