Squeezing the lemon. Getting some ROI from SSRS.

First of all, I am going to shamelessly plug our Business Intelligence (SSRS) services. If you aren’t already firmilar with our capabilities, I am going to strongly recommend perusing our site or contact us directly. Since thats out of the way, we can get to the squeezing part.

Awareness

One of our clients operates with a SQL based product and has done so since it’s inception. It wasn’t until 2010 that they began to use SSRS. Even now, it’s not leveraged as much as it could be. Why would they go years without exploring the possibilities for their BI needs? Maybe they didn’t have the staff knowledge or awareness to seek it out? Companies must be aware of their assets and tools.

Don’t Pay Twice

When recommending the usage of SSRS, their first question was “how much does it cost?” Some businesses don’t realize that if they already own a SQL Server license, they also have access to SSRS as well. It took them by suprise when we shared this info.

We’ve encountered environments where Crystal Reports is used as the default reporting platform. Curiously, each time it has been due to another larger software system which came packaged with Crystal inside. The executives weren’t really aware there were alternatives. Don’t get me wrong, we think Crystal is a perfectly fine option for any company’s reporting needs and in those cases, it made more business sense. The problem is that those same systems use a MS SQL server as a back-end and the client is effectively paying twice for BI and reporting capabilities.

Augment

Maybe you’ve known about SSRS and have been using it for cursory reporting needs. How can you stretch your dollar further? Aside from bringing in consultants to analyze your business intelligence needs, you can augment the capabilities with an analytics suite like Strategy Companion – Analyzer or MS Dynamics. Either way, you’re paying for something. SSRS is a reporting platform. It’s not magical, but it can be powerful in the right hands. Your business needs should dictate the pros and cons of adding a suite or hiring a consultant.

Integrate

Incorporate SSRS into your business process. Are you still trying to maintain Excel charts? Or Access databases? Having to hobble them together for your business reports at the end of the month? If you already have a SQL server in your enterprise, you should be automating all of these tasks in SSRS instead. If you don’t have SQL server then you should consider the cost of labor to make all of your reports vs the cost of a SQL server license.

Do you have line of business applications that you depend on for your operations? If you’re not integrating those with SSRS, its a great opportunity lost. Microsoft provides Web Service end points for application integration with SSRS. Any application that can consume SOAP web services can also integrate with SSRS.

Conclusion

Whether the concept is new to you or not, SSRS can still be used to a greater potential in most enterprises. If any of these points struck a chord with you or you’re just simply in a head-spin, I would encourage you to learn more about our services.

 

 

Using Microsoft ReportViewer with WPF

Sometimes Microsoft delivers new technologies that aren’t as polished as we would like. Using the MS ReportViewer in a WPF UI project is one of those times. The issue is the lack of a native WPF control for viewing SQL Server Reporting Services (SSRS) report files. As far as I am aware and as of the date of this blog post, there is still no native control released by MS. It is the purpose of this posting to walk through how to integrate the Winforms version of the ReportViewer control with a WPF project.

The SSRS package includes a ReportViewer component, which is used to host or display a report inside a Windows Forms control. As mentioned earlier, for reasons only known to MS, the control for WPF hasn’t been created yet. To display a report in WPF using the Windows Forms control we must run the control in a special host container that can proxy compatibility between Winforms and WPF.

The WindowsFormsHost control for WPF can be found in the “WindowsFormsIntegration.dll” assembly provided with .NET 4. Its purpose is to fully integrate and host a Windows Forms control in a WPF control. It can host any controls that derive from the System.Windows.Forms namespace. The downside of using this control is that we lose the ability to control the layout of the content in the designer because it doesn’t render until runtime. An alternative is to make a WinForms User Control and design it beforehand so you get the desired layout results at runtime.

To use the control, add the following references to the WPF application that will host the control:

  • System.Windows.Forms
  • WindowsFormsIntegration

In addition to the references, you will need to select the appropriate version of the ReportViewer control. v9.0 for SQL 2005 and v10.0 for SQL 2008.

Next we will need to set some base XAML. In this example, the control will take up the entire window.

<local:WindowBase x:Class="Pineywoods.Example.UI.Forms.ReportViewerForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Pineywoods.Example.UI">
        <Grid x:Name="LayoutRoot"/>
</local:WindowBase>
									


Here is the code to go along with the form. We create the WindowsHostControl and add it as a child of LayoutRoot. The actual report is a child of the WindowsHostControl, which acts as the proxy.

try
{
    // Create instance of WindowsFormsHost to integrate the report viewer control with the WPF form. 
    WindowsFormsHost host = new WindowsFormsHost();

    // Create instance of Report Viewer Control 
    Microsoft.Reporting.WinForms.ReportViewer reportViewer = new Microsoft.Reporting.WinForms.ReportViewer();
    reportViewer.ProcessingMode = ProcessingMode.Remote;
    reportViewer.ServerReport.ReportServerUrl = new Uri("SSRS_SERVER_URL");
    reportViewer.ServerReport.ReportPath = "ITEM_PATH_HERE";

    // Set the Basic authentication credentials. (http://msdn.microsoft.com/en-US/library/microsoft.reporting.winforms.reportservercredentials.networkcredentials(v=VS.100).aspx)
    reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential("JOE_USER", "SECRET", "");

    // Causes the current report in the Report Viewer to be processed and rendered. 
    reportViewer.RefreshReport();

    // Sets the child control hosted by the WindowsFormsHost element. 
    host.Child = reportViewer;

    // Add the WindowsFormsHost element to the Grid in the ReportViewer.xaml 
    LayoutRoot.Children.Add(host);
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}

									

Hope this quick post helps someone to avert the frustration we encountered when integrating the control for the first time.