Reputation: 157
I have 2 date/time parameters, to and from. From was set to =DateAdd(DateInterval.Year, -1, Today())
. And the other, to, was set to just =Today()
.
When I view the report, the default values are populated correctly and the report is generated correctly on first load. However, when I change the from date field, the report refreshes. If I change just the to field, it does not refresh.
Reading other suggestions on other sites, someme people mentioned creating a new dataset with something like Select GetDate() as Date
and then using that as the default value of my parameter, but that didn't work. Another was creating an internal parameter and setting it's default value to =Today()
and then using that value as my parameter's default - again, didn't work.
Anything else I might try?
Upvotes: 2
Views: 1688
Reputation: 157
More searching gave me my answer:
@Piquet - Your solution appears to be correct...at least in my case which seems similar to most of the other posts. I was using default values for date parameters that were expressions - "=Today()" and "=DateAdd("yyyy",-5,Today())". And no matter what I tried when changing the value of the report's first parameter would cause a page refresh that generated a blank/report.
I testing changing all parameters default to No Default where they were using expressions and viola no blank page refresh. To get back the default date values I'm now using a dataset like this:
Select CONVERT(date,(DateAdd("yyyy",-5,GETDATE()))) AS default_start, CONVERT(date,GETDATE()) AS default_end The blank page refresh is gone when changing the value of the parameters and the default date values are working fine.
Thanks for the post as it seemed an elusive problem. David
From this MSDN thread.
There's also a lot of information in that thread about how if you have two parameters, the second one is assumed to be dependant on the first if they both have expressions:
For example, if you have a report with Param1 and Param2, RS will assume Param2 depends on Param1 if:
- Param2 is populated from a query that uses certain types of expressions for query text, query parameters, calculated fields, filters, etc.
- Param2 is populated from one or more expressions.
Upvotes: 1