Skip to Content
0

Parameter prompt when exporting and/or Printing a report

Dec 09, 2016 at 05:04 PM

104

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Dec 16, 2016 at 06:33 AM
0

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!

Share
10 |10000 characters needed characters left characters exceeded
Dell Stinnett-Christy Dec 09, 2016 at 05:26 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 24, 2017 at 04:33 PM
0

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?

Share
10 |10000 characters needed characters left characters exceeded