Posts

Report Viewer SP1 Redistributables

As I mentioned in a previous blog, Visual Studio 2005 SP1 includes updated versions of both the WinForms and ASP.NET versions of the Report Viewer control. Microsoft has just released full and upgrade redistributables for the Report Viewer SP1.

Roll Your Own UDM Schema Generator

Documenting the UDM schema is a common requirement but to the best of my knowledge neither Microsoft nor third-party vendors provide schema generators. While you are waiting for a commercial tool to fill in the gap, you can roll out your own schema generators. Thanks to the Analysis Management Objects (AMO) library, this task is remarkably simple to implement. For example, here is a .NET code snippet that builds upon the DisplayObjectNames sample (included in the SSAS samples). The code loops through all SSAS databases on the server, traverses the dimension attribute hierarchies and measures and displays their names and source columns.

foreach (Database db in server.Databases) {


Console.WriteLine(“{0}”, db.Name);


// Display Dimensions


Console.WriteLine(“\tDimensions:”);


foreach (Dimension dimension in db.Dimensions)

{


Console.WriteLine(“\t\t{0}”, dimension.Name);


// Display attributes


Console.WriteLine(“\t\t\tAttributes:”);


foreach (DimensionAttribute a in dimension.Attributes)


Console.WriteLine(“\t\t\t\t Name: {0}Source: {1}”, a.Name.PadRight(50), GetKeyCollection(a.KeyColumns));

}


// Display Cubes


Console.WriteLine(“\tCubes:”);


foreach (Cube cube in db.Cubes) {


Console.WriteLine(“\t\t{0}”, cube.Name);


// Display Measure Groups


Console.WriteLine(“\tMeasure groups:”);


foreach (MeasureGroup mg in cube.MeasureGroups)

{


Console.WriteLine(“\t\t{0}”, mg.Name);


// Display attributes


Console.WriteLine(“\t\t\tMeasures:”);


foreach (Measure m in mg.Measures)


Console.WriteLine(“\t\t\t\t Name: {0}Source: {1}”, m.Name.PadRight(50), m.Source.ToString());

}

}

}

Get More Out of SQL Server Reporting Services Charts

One must-read SSRS resource which I missed was the excellent article “Get More Out of SQL Server Reporting Services Charts” by Robert Bruckner from the Reporting Services dev team. Now I have something to point folks to for how-to chart-related questions.

Report Builder and Text-based Calculated Members

Although not a common practice, UDM supports defining text-based calculated members. For example, here is an useless but valid text-based calculated member:


Create Member CurrentCube.[Measures].[Hello] As “Hello”;


Much to my surprise, a text-based member won’t show up in Report Builder. That’s because the Report Builder defaults the member’s data type to float and the text is simply “lost” when the report is run. How does the Report Builder determine the field data type with UDM as a data source. With regular measures, it’s simple: the Report Builder derives the field type from the DSV data type. It seems that for calculated members, however, the Report Builder always defaults the data type to float.


While there may other workarounds to resolve this issue, one way is to “correct” the Report Builder invalid assumption about the member data type. Since one would typically auto-generate the Report Builder model when UDM is used as a data source, the ultimate hack is to change the model directly. To do so, go to the model properties in the Report Manager and click the Edit button to save the model as a file. Then, find the text-based member (attribute) by name and change its type from float to string. Then, back to the Report Manager, click the Update button to update the model from the file. As a result, the report will show the member text values correctly.

Presenting at TechEd 2007

Microsoft has just let me know that my proposal for a TechEd 2007 breakout session has been approved. I’ve been honored to present Microsoft SQL Server Reporting Services for four consecutive years at TechEd. This time, I will share practical lessons and tips harvested from report-enabling a real-life application. Here is the formal session description (not yet on the TechEd website):

One of the most prominent feature of Microsoft Reporting Services is its open and extensible architecture that allows developers to report-enable easily their custom applications. Join this “from-the-trenches” session to learn how we leveraged Microsoft Reporting Services 2005 and SQL Server 2005 to add ad-hoc reporting features to our line-of-business application. Topics covered include:

  • Understanding the importance of the Report Definition Language (RDL)
  • Building an RDL object model to abstract access to RDL
  • Integrating the application middle tier with the Report Server web service
  • Implementing flexible data retrieval with SQL Server 2005 CLR stored procedures
  • Using the VS.NET 2005 Report Viewer control for report viewing
  • Caching reports for better performance and historical analysis
  • Securing access to the report catalog with Windows and basic security
  • Extending reports with custom code

 

See you in Orlando!

Black Preview

An unfortunate bug that was discovered late in the SQL Server 2005 SP2 design cycle may cause a black report preview in the ReportViewer Windows Form control (see attached file) with some video cards. The RS team is aware of this and they are working on a hotfix. I am partly to blame for this issue ([:S]) because I’ve noticed it since the early builds of SP2 but it never occurred to me that it could be a bug. I thought that it could be cause by remoting it to my desktop (sometimes after logging in locally to your desktop after a remote session the colors tend to appear funny).

It is important to note that this issue only happens in Print Preview mode (normal preview and Report Host (F5) are unaffected). If you don’t like the new black preview look and feel please contact Microsoft Product Support for a hotfix when it becomes available. Meanwhile, as a workaround, you should be able to avoid the black preview by setting the background to any other color than trasparent (default background color).

SQL Server 2005 Service Pack 2 is Born

As an update to my previous post, SQL Server 2005 SP2 is now officially available. The SP2 build is 9.00.3042. A SP2 landing page is available too that includes links to the SP2 release, KB articles, marketing information about the benefits of SP2.


As a personal contributor to Service Pack 2 (mainly in the areas of Reporting Services SharePoint integration and Analysis Services), I hope you enjoy it!

Presenting SharePoint-SSRS Integration

It’s time for my annual presentation for the Atlanta.MDF group. This time, the topic will be the SSRS-SharePoint integration mode with SQL Server 2005 Service Pack 2 which I blogged about before. I’ve uploaded the PowerPoint slides to my website.

Kudos to Report Builder as UDM Client

Its UDM support limitations withstanding (a partial list here), the Report Builder should definitely be on your list if your requirements call for ad-hoc reporting from an SSAS 2005 cube. Here are some Report Builder features that I particularly like:



  1. Ability to pre-filter the data on the report before the report is run. In comparison, Excel takes the optimistic approach to load all dimension members before allowing you to set a filter. This can surely send Excel in a la-la land if your cube has large dimensions (hundred thousand or more).

  2. Support of calculated columns. For some obscure reasons, the Excel UI doesn’t have an UI interface for creating calculated members (you can do so programmatically however).

  3. Standard report look and feel. In comparison, Excel limits the user to the PivotTable fixed layout (assuming that the user doesn’t convert the report to formulas).

  4. My Reports which allows the business user to save her reports in her own area of the report catalog if she doesn’t have rights to write to other folders.


  5. Nice filter support. This may not be so obvious but each SSAS attribute hierarchy supports an InstanceSelection property which the Report Builder honors. For example, the attached image shows what happens if you set InstanceSelection to List or FilterList (no UI difference between the two). Another filter UI selection is dropdown.

Of course, the Report Builder-UDM integration will improve in future releases (believe me, I am banging hard on the SSRS-SSAS integration door) to make it even more compelling choice for UDM reporting.

Report Viewer Enhancements in VS.NET 2005 SP1

As you probably know by now, Microsoft has recently released Service Pack 1 of Visual Studio.NET 2005. Since the Report Viewer controls are owned by the VS.NET team, it turned out that they have been updated also. Many bug fixes have been implemented. The new features include:

Report Viewer ASP.NET Control Enhancements

  • Reset method to reset the control to its default values.

Both ASP.NET and Windows Forms versions

  • ServerReport.Cookies property to pass cookies to the server (useful if the Report Server is configured for custom security).
  • ServerReport.Headers property to pass custom HTTP headers to the server (useful if the Report Server is configured for custom security).  
  • New (currently undocumented) IReportViewerMessages2 interface for localizing additional menu strings that were not covered by the original IReportViewerMessages interface.

Strangely, VS.NET 2005 SP1 doesn't update the product documentation (perhaps, the next edition of MSDN library will) so you need to rely on the online documentation.

How can you tell if you have the SP1 version of the controls? Once you install SP1 (don't interrupt the second part!!!), open Windows Explorer and navigate to C:\Program Files\Microsoft Visual Studio 8\ReportViewer. Right-click on one of the assemblies there (e.g. Microsoft.ReportViewer.WinForms.dll), choose Properties and flip to the Version tab. The file version should be 8.0.50727.762 and it should match the GAC version of the same assembly.