Category Archives: Business Intelligence

How to avoid cell merging when exporting to Excel in SSRS 2008

Have you had problems with merged cells in excel exports from Reporting Services reports? I have so I did some hunting around and found some information that looks like its solved my problem.

Add this post and the information at the following MSDN blog and you should have your problems with merged cells in excel exports from Reporting Services reports nailed.

http://blogs.msdn.com/b/chrisbal/archive/2006/07/08/659545.aspx

Ed Spencer's Blog

Lets be completely direct here. Cell merging in Sql Server Reporting services after exporting to Excel, is a common nightmare.

It happens because the engine that transforms the report tries to do so on a presentation basis.

I have been developing reports in SSRS for a few years now, and here are the best ways around the issue that I have found:

1. Don’t use standalone textboxes for titles, or any non-data elements.
Rather than fiddle with these for hours trying to get them to line up, just insert another row or two as headers above your data driven report element (e.g. table). You can then play with the presentation of the cells to make it look like it isn’t part of the same table. This can be done by colouring certain borders white to give the impression that there is nothing there.

2. Use points and not centimetres when…

View original post 96 more words

Advertisements

Leave a comment

Filed under Business Intelligence, General SharePoint Development, SharePoint 2010, SharePoint 2013

Whitespace in Excel and other issues with exports from Reporting Services

I discovered some interesting behaviour in the Excel export files from Reporting Services today. Some users of the system I’ve been working on have a requirement to periodically export the data in MS Excel format so they can do some additional analysis. They recently began testing the export function on the report in question and have noted theat they are unable to generate a pivot table because there are additional empty rows and columns before at the top and on the left of the table in the spreadsheet.

My assumption was that when you export to Excel the export rendering engine would only attempt to output the tables on the page. Obviously my assumption was invalid and the rendering engine attempts to render into Excel as closely as possible to the web version including any whitespace around the report. The more whitespace the more blank cells, rows and columns will appear in the Excel export. The quick solution to the issue is to simply move the various object on the report so the edges butt up against each other and the sides of the page. Removing the whitespace in this way means the rendering engine wont include additional empty rows or columns in the spreadsheet.

Note also that I’m note using a head or footer for the exportable version of the report. These will also cause issues if the purpose of the export is to apply a pivot table to the data for analysis.

In-line images also cause issues in the exported Excel spreadsheet. I have small icon in cells in the table with actions defined to open sub-reports. The images were embedded in rectangle objects to enable control of positioning and size. The behaviour I saw in the Excel export spreadsheet was that I had merged columns around the images and this again interfered with apply a pivot table to the data. My only solution here was to remove the images from the exportable version of the report.

Finally, the report had two tables on the page. The first was a summary table and the second was a table containing the detail row for every item meeting the users selection parameters. When the user exports to Excel both tables appear on the one spreadsheet and the user is unable to simply create a table or pivot table on either of the data tables. Ideally the user wants each data table on its own spreadsheet. The resolution to this is again simple if you think in terms of what the rendering engine is trying to do i.e. render what it sees on the page into a similar looking spreadsheet. First we want to force the second table to appear on a new page. This is achieved by configuring the tablix for the first table to put a section break after it (see image below). Once this is configured the second table will appear on a separate page and the rendering engine will interpret the section break as needing to put the second table onto a second sheet in the Excel file.

PageBreak

Leave a comment

Filed under Business Intelligence, General SharePoint Development, SharePoint 2010, SharePoint 2013

Create a report builder 3.0 (ssrs) filter on boolean list of values in IN clause

So the latest requirement in my report building project is to provide the user with a checkbox (boolean) choice to include activities in the report which were marked as to be excluded from reporting when they were entered. I know it seems to sort of defeat the purpose of having such a flag in the first place but it is still something that the requirements definition says should be available to the report user. So in the report we add a boolean parameter to provide this option that looks something like this

Capture

and in the report itself looks like this…

Capture

The issue arises when we look to utilise this to filter the report data. In effect we are saying that by default we only want records where the dataset flag is equal to False but if the user selects True for the parameter we want the dataset to return records where the flag is equal to both True and False. Looking at the options for using dataset filters I could see a simple way of achieving this so I took a step lower down and implemented this requirement as part of the WHERE clause utilising the parameter within the SQL query. Basically I wanted a WHERE clause that in the default case was a pure ‘= 0’ and in the second case was an IN clause. Whilst a clause such as

 ActivityData.ExcludeFromReports IN (0,1)

would work in SQL I couldn’t find a way of having the parameter in Report Builder pass the (0) or (0,1) to the query as the validation parsing that occurs when trying to create this blocks it given that the field in the dataset is Boolean.

Here is the clause that I finally came up with that provides the filtering functionality described above..

AND (ActivityData.ExcludeFromReports <= 
        (CASE WHEN @IncludeExcludedActivitiesParameter = 1 THEN 1 
              WHEN @IncludeExcludedActivitiesParameter = 0 THEN 0 
         END))

Simple but elegant! We know that boolean can only be 1 or 0 so when we want all records returned we look for those where the ExcludeFromExceptions flag is less than or equal to 1 (hence both settings) otherwise we only return those records where the ExcludeFromExceptions flag is less than or equal to 0.

Leave a comment

Filed under Business Intelligence

Filtering datasets using a boolean report parameter to determine IN value set

Have you every come across a reporting requirement where the user of the report needs to be able to choose between two sets of criteria to filter on a value in the main report. I recently had a requirement where the report I was developing listed tasks by default that had a status of Active or On Hold but I needed to be able provide the user with the ability include tasks with a status of  Initiation, Closed or Cancelled.

The standard report parameter configured for multivalue could meet the underlying requirement by setting the default selections to Active and On Hold  and allowing the user to add in the remaining 3 status’ if they required for example:

Status Multivalue Parameter

but for this report the requirement specified that the user should only have to make a yes/no decision regarding whether to include the additional status tasks in the report i.e.

Boolean Status Parameter

I looked closely at the configuration options for Boolean report parameters and tried a few different things try to configure it so that the two possible values it could be set to were the two status value sets but given it is a boolean the only values it can set the parameter to are 1 or 0. A logical restriction but not helpful for meeting my requirement.

I looked at the options for configuring other types of parameters, such as the Multivalue type, to display like a boolean but again  found nothing helpful for meeting my requirement.

I eventually  solved my problem using the Boolean type parameter and expressions within the filter criteria on the main report dataset.
Here is how I set it up…

1. First set up the boolean report parameter:

BooleanParameter

and configure the default value to False (for my requirement)

SetFalseBooleanParameter

2. Now create two report parameters that will provide the two value sets for the filter. Set the Name of each parameter so it is evident which one includes and excludes the values. In my case I used StatusExcludeSet and StatusIncludeSet.  Set the Data Type to Text and check Allow multiple values. I also selected Internal for visibility as we don’t want either of these parameters to appear to the end-user or be available for setting within SharePoint.

Capture3

To complete the configuration of the parameter select Default Values from the left panel, select Specify Parameters and then add the default values. In my case these are the actual strings Active and On Hold but check in your dataset to verify you don’t need to specify the actual Id values here rather than the display text.

Capture4

Don’t forget to repeat this step for the second parameter that includes the additional values in the set that were excluded in the one you’ve just created.

3. Next open properties dialog for the primary dataset, select Filters on the left panel, click Add to create an empty filter and select the relevant field, in my case Status, for the Expression e.g.

Capture2

4. Next we need to configure the value that will be used for filtering. We will be filtering on a set of values so change the filter Operator to In (as shown in the picture above) and then click on the function (ƒx) button to the right of the Value field. For the expression I used the IIF conditional function to test the value of the boolean parameter IncludeExtraStatusParameter and based on its value return either the value set contained in the Internal parameter StatusExcludeSet or StatusIncludeSet e.g.

 =IIF(Parameters!IncludeExtraStatusParameter.Value = CBool("False"), Parameters!StatusIncludeSet.Value, Parameters!StatusExcludeSet.Value)

Capture6

Leave a comment

Filed under Business Intelligence, General SharePoint Development, SharePoint 2010, SharePoint 2013

Report vs Dataset Caching in SharePoint

In one of my previous posts I mentioned two techniques for improving the performance of reports hosted in SharePoint … Dataset caching and Report caching, but how do you decide you which one to apply?

Report Caching when enabled will stored a copy of the data required to run the report (this is not to be confused with snapshotting of reports where a complete rendered copy of the report stored). The cached data is only accessible to the report that cached it and can have specific refresh and expiration configuration settings that suit the requirements of the report. This is particularly appropriate for reports that contain information that is periodic in nature (e.g. daily/weekly/monthly status reports) but the information isn’t referenced in other reports. It should be noted that if data shown in a cached report changes this will not be updated in the report until the cache is and as a result you may find any other reports that reference that data directly will show different, more current, results

Shared Dataset Caching enables the storage of the data on a per dataset basis. The cached data is accessible to any report that depends on the Shared Dataset and all reports gain the performance advantage from the cached data. This is particularly appropriate where the rate of change of the various data sources is understood and can be taken into account when configuring the caching of the various shared datasets you have available. Configuring each Shared Dataset’s cache properties to take into account the churn rate on the source data will enable you ensure that the data stored is maintained at optimum freshness whilst still delivering the improved performance benefit to your reports of not having to query all the way back to the SQL Server for the data.

If you are combining both approaches, which is technically feasible, careful consideration should be given to when the cache at each point is expired/refreshed, how often the source data is expected to change and what the requirements of the consumers of the reports are regarding the currency of results displayed in reports, for example do they require the figures correct as of 12pm each day or the most up-to-date figures possible?

Leave a comment

Filed under Business Intelligence, General SharePoint Development, Project Server 2010, SharePoint 2010, SharePoint 2013

Report Data tab not appearing in VS2010

Hit an interesting problem today whilst trying to use Visual Studio 2010 to build a report (.rdl). Here is the background and the solution.

I started out by creating a fresh Report Server Project. Next I added a Shared Data Source and then a set of Shared Datasets for use in the reports I’m planning on building. With the plumbing in place I added a new item under the Reports folder and selected Report (not Report Wizard) to provide a blank canvas on which to build the report.

Being very familiar with building reports in Report Builder from SharePoint I was baffled as to why Visual Studio didn’t display a Report Data tab anywhere. I looked logn and hard within Visual Studion but could not find any indication of how to turn it on. A brief search on youTube showed me that I wasn’t unreasonable in expecting a Report Data tab to be present as the videos I looked at all had it visible on the left side of the Visual Studio IDE either below or tab alongside the Toolbox tab.

After some investigation I still don’t know why its not appearing in my IDE or why I can’t find it within the GUI but it turns out as with nearly everything in Visual Studio there is a keyboard shortcut for switching it on and off.

The ‘Show Report Data Pane’ keyboard shortcut to switch on the Report Data tab/pane is: CTRL+ALT+D

N.B. Apparently the solution to this problem through the IDE is to go to the Data menu and choose Show Data Sources. The Data menu option doesn’t appear for me 😦

Leave a comment

Filed under Business Intelligence

Performance Tips for SSRS Reports

Here are a few tips I’ve discovered whilst building SSRS reports to host in SharePoint. Some of these are report based tips and a few apply to SharePoint. I willadd to and update these as I discover more.

1. [Report based] Avoid using the Total Pages built in field as if you use this the rendering engine has to complete a full pre-render of the entire report primary dataset before it starts the final render. This can add a great deal of processing overhead and the report will take much long to finally display;

2. [Report based] Ensure results are paged. This should occur by default but if you choose to turn it off for your report there is a risk that you will encounter problems as the HTML rendering format that is used to initially render a report opens the report in your browser. If the report is not paginated, all of the data is included in a single page, which cannot be accommodated by most browsers.

3. [SharePoint] If the source data changes infrequently consider setting up dataset caching and make use of Shared Datasets to reduce the number of cached results stored on the server.

4. [SharePoint] Consider the usage scenario of the reports and where appropriate implement caching of the report. For example if the report is a monthly financial statistics summary you could cache the report once a month rather than have it dynamically update everytime someone views it.

1 Comment

Filed under Business Intelligence, SharePoint 2013