on 08-01-2009 10:13 AM
I've tracked down why I was getting this error to the refresh method of the ReportDocument object.
The sequence of execution is as follows;
load report
get/set parameter values
set database location
refresh report
export report
The refresh step clears all the parameter values and defaults. I can't believe that this is correct behavour but hey ho, I'll try and work around it by saving all the parameter values to local storage when I open the report and then reset them after the refresh.
Is this correct?
Steve
No, that is exactly how the refresh is supposed to work actually.
The reportdocument.refresh call removes saved data. That includes any parameters set on the report.
99% of people who call reportdocument.refresh do not have a need to do so to be honest.
If you are using an empty report template (ie a report that does not have saved data) then you should not need to call it at all.
If you want to call it just to make sure, do it before you do anything else, then pass any information you need to the report object.
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jason, but I'm still a little surprised that after a refresh the default values are cleared. I can appreciate that the values collection would be trashed, but not the default values entered at design time.
I think that most people would call the refresh method - the only reason why they wouldn't is if either the report doesn't have any saved data or they haven't changed any parameter values. Otherwise, they are always foing to get the saved data out.
Steve
I am not understanding what you mean by it blows out the default values?
The only thing that setting a default value does is make it the top of any lists of parameters or automatically select it for you if you allow the report to prompt for parameters.
If my memory serves me correctly you should still have to actually pass a parameter to the report at runtime if you are assigning them via code and not letting the report itself prompt the user. It does not just use the default value if no value is passed, it will fail with a missing parameter value.
Jason
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.