Per user snapshots? Or multiple snapshots for a report each with different parameters at the same time

I've received questions in the past about whether the report server supports per user snapshost - that is report snapshots customized with different parameter values for a given user.   The answer I have always given is no - you get one snapshot per report and that snapshot always uses the default parameter values.

Well, it turns out that some inventive users have come up with a 'work around'; it involves some coding on your part.  But here's the sketch:

Though RS supports only 1 *execution* snapshot per report, it supports N *history* snapshots per report.  Also, you can cause a history snapshot to be created programmatically.  So there we have it - "all" you need to do to create a set of history snapshots with different parameter values is automate a few steps: 

1) Set the default parameter values for the report using the SetReportParameters SOAP API

2) Call the CreateReportHistorySnapshot SOAP API after step 1. 

3) Repeat - as in lather, rinse, repeat ;-).

The reason we've found out about this workaournd is that there is one catch - history snapshots have a resolution of 1 second in reporting services.  That means that if you try to create 2 history snapshots within the same second (time), the second (order) request is *ignored* - CreateReportHistorySnapshot returns the same history id for the second request as for the first request.  You'll need to add a delay in your code to compensate.  Based on the comment below from b5lurker, a delay of 1.001 seconds works well in practice.

Finally, since History Snapshots are identified in RS only by their ID and the time they were created, you'll need to be able for your end users to correlate the history snapshots with their parameters.   You can do this in multiple ways - store the correlation in a database somewhere, flat file, etc.  Of course you could do it all within RS by storing the information as custom properties on the report itself by using the SetProperties SOAP API.

You'll also likely need to create some management/viewing UI for controlling how many of these 'history' snapshots are stored on the server due to size limitations.  You'll also want to have the UI allow end-users to view the right snapshot.

Finally, you should consider this a work around not a recommended solution – due to the idea represented here if you have a set of interactive users trying to browse the report live, while you’re generating your history snapshots, they might see wildly different default parameter values. 

Kudos go out to Hi_i_am_Amit and b5lurker from the MSDN Reporting Services forum that brought this workaround to our attention via their debugging efforts.  Here are their threads, respectively.  You may want to ask them what else they did to make this solution really work in their environments.

Take care and good luck,


Comments (3)
  1. says:

    I may be missing something, but would this be an easier solution:

    1. Turn on caching for your report.

    2. Create a data driven subscription which delivers to the null delivery provider. It will run the report once for each parameter combination you need.

    Now when the user runs the report, it won’t actually need to hit the datasource, just the SSRS cache.

  2. Furmangg above wondered if setting the report to cache and having a D-D subscription populate the cache was an easier solution to the problem.  Not quite.  Let me explain – cache is generally useful for relatively shortlived data.  It is primarily used to reduce the load on the report server.  Snapshots are used in one of 3 scenarios:

    1) You need a single standard view of the data

    2) Your data does not update frequently – a data warehouse populates once a day

    3) You need to potect the underlying data sources against interactive query load.  

    While caching is useful also in the 3rd scenario, it has a little different effect – a snapshot report ensures the report queries are run only when the snapshot is being created.  Afterwards, they are not executed (caveat: parameter queries may be reexecuted).  Cache only prevents report execution for a particular set of parameter values.  So you might have additional query load on your underlying server.

    The interesting thing about using history to run reports with multiple parameter value combinations is that you can then refer to these executions later on programmatically by tracking the which combination corresponds to your report history.

    Hope that helps,


  3. b5lurker says:

    Thanks Lukasz for providing visibility to this issue. I am the same b5lurker from the MSDN forum post that you linked to.

    Is there any possibility of this being addressed in a future release of SSRS?

    In the MSDN post I mentioned that you can see a GUID being created for each snapshot in the History table, so I would think that this should be used instead of date/time. I also mentioned this issue to Brian Welker at TechEd Boston last year.

    We have our console app working fine and avoiding the duplicate calls by having it delay by at least 1 millisecond longer then 1 second before making the next request. The console app is still multi-threaded, but only to adding entries into an MSMQ queue for each report. It would be great if we could remove the delay once this issue is resolved and the snapshots can be referenced by GUID instead of date/time of generation.



Comments are closed.

Skip to main content