System – SSRS 2008R2 using report builder 3.0 (or BIDS if you think the answer lies there)
Objective – Create a report that displays sales data from the past 24 hours for each sales region. The report needs to refresh every 10 minutes, and always show the last 24 hours from the last refresh. However – the users still need to have the ability to change the time frame.
What did I do?
- Built a report that shows sales data for a single region depending on 3 parameters: StartTime, EndTime, RegionCode. Lets call it RegionalSales
- Built a master report that includes multiple subreports of RegionalSales. the master report has 2 parameters – StartTime (with a default value dateadd(“h”,-24,Now())) and EndTime (with a default value Now()). I am sending StartTime and EndTime to the subreports, and every subreport is assigned it’s own region.
- I’ve set the Auto-Refresh property of the master report to 600.
Results –
At first everything seems perfect – the master report loads, and the data shown is correct for the loading time (let’s say 22:08). However, after the auto-refresh (that occures at 22:18) the data is still correct as to 22:08.
The problem is that on the first load of the report the parameters get their default values as I stated (StartTime = 10/12/2011 22:08 & EndTime = 11/12/2011 22:08).
However, on the auto-refresh instead of the paramters updating (So I'll get StartTime = 10/12/2011 22:18 & EndTime = 11/12/2011 22:18) I still get the old values (StartTime = 10/12/2011 22:08 & EndTime = 11/12/2011 22:08)
Any thought on why, and how can I change this?
Thanks!
If I understand correctly…
Unfortunately, report parameters get their values only at the first load unless the user manually clicks the View Report button.
To get around this, I’d try converting the date parameters to not use default values, but rather get their values from a query and use the equivalent of GETDATE() for your RDBMS. If I’m not mistaken this will require you to add another DataSet to your report… but it won’t really be a dataset since the query for it will simply be SELECT GETDATE() [or the equivalent for your RDBMS] and whatever transformations you need to do for that.