cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter prompt when exporting and/or Printing a report

Former Member
0 Kudos

With our reports there are usually a set of parameters that the user specifies at runtime and another set of parameters that are set in the background. I need to only prompt for the parameters that have not been set. When previewing the report in crystal reports viewer, it seems to be able to determine what has values and only prompt for the ones that don't. However, this doesn't seem to be the case when I prompt for the parameters when exporting or printing the report straight to the printer. This is what I'm using code-wise:

CrystalReportViewer viewer = new CrystalReportViewer();

viewer.ReportSource = rpt;

viewer.RefreshReport();

I can see using the HasCurrentValue parameter for each of the parameterFields that they do have values set but for some reason they are still shown on the prompt dialog. Is there anyway that I can hide these parameters?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks for your reply, but I managed to get it working with setting

crystalReportViewer1:ReuseParameterValuesOnRefresh = true;

Though for some reason, it doesn't work with just that parameter, I needed to load the parameter count first by assigning something like

paramcount = crystalReportViewer1:ParameterFieldInfo:count prior to running viewer.RefreshReport();

Anyway, it's all good now! Thank you!

Answers (2)

Answers (2)

Former Member
0 Kudos

I have this same problem. So far I've tried:

Setting CRViewer1.ReuseParameterValuesOnRefresh = True at design time

Setting CRViewer1.ReuseParameterValuesOnRefresh = True at runtime

Calling Dim ParamCount As Integer = CRViewer1.ParameterFieldInfo.Count before calling CRViewer1.RefreshReport()

Everything works fine on certain machines but not others. I can't pinpoint the difference. I've installed SP19 and it hasn't fixed the issue. I have other machines on SP18 that work properly. Does anyone have any other suggestions?

DellSC
Active Contributor
0 Kudos

Unfortunately, there is no API to control the parameters screen when running reports. You would have to create your own parameter screen that would allow the user to specify values for the parameters that are not set in the background and then programmatically set those values on the report prior to viewing or exporting it.

-Dell