BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
Posted by Andy Brown on 01 October 2012
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Preventing Data Caching when Developing SSRS Reports
How can you be sure that you're seeing the latest copy of any data? The answer: disable report caching. This blog explains what the problem is, then gives two-and-a-half possible solutions.
The Problem: Data is Cached
So - you run a report listing out various films from a Movies database, and get:
The first couple of films from our report.
You decide that Jurassic Park was too long (that scary bit with the T. Rex should be cut), and make a change to your data:
The owl's cut: 1 hour 40 minutes should do it.
You then rerun the report, and nothing has changed:
The film length hasn't changed in the report, even though the underlying data has.
This problem comes about because SSRS is trying to speed up your reports. Whenever you run a report using exactly the same combination of parameters (where there are any) as for the previous time you ran the report, you'll see cached data.
Solution 1 - Just Refresh the Screen
A simple solution is just to refresh the data for your report:
Click on the icon shown to see the latest data for your report.
Solution 2 - Delete the Cached Data
A second solution is to delete the cached data file:
Find the file with extension .rdl.data in your project in Windows Explorer and delete it - you'll then get the latest data when you run your report.
This isn't a great solution: you have to keep doing it again (as the file shown is recreated whenever you run the report); there's always the risk you'll delete the report itself by mistake; and you have to delete the report through Windows Explorer, as it doesn't show up in Solution Explorer in Visual Studio.
Solution 3 - Change your SSRS Configuration
You can - in theory - prevent report caching by changing your configuration settings - but first you have to find them! The folder path will be something like:
Once you've found this folder, you can double-click on the file called RSReportDesigner.config to edit it:
Double-click on this file to change your settings.
You can then change the CacheDataForPreview option to false:
Change the value of this option from true to false to disable data caching.
However, this change doesn't seem to have any effect in SSRS 2008 (although I suspect it did work in earlier versions), and Microsoft seem to agree.
If anyone can throw any more light on this, please do so via the comments at the bottom of this web page.