cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable "Enter Parameter Values" for optional paramters?

0 Kudos

I'm having issues getting the Crystal Reports .NET Viewer to suppress the "Enter Parameter Values" dialog for optional parameters. I have templates created using Crystal Reports 2008 and am linking against the CR for VS 2010 runtime.

Within the report template the optional paramter has "Optional Prompt" set to "True". This particular parameter also allows multiple values and is used in record selection. Within the record selection it is using HasValue().

It seems the parameter is set up properly as I have other parameters that are set within the code that are not prompted for. If I pass in the optional parameter through the code the "Enter Paramater Values" dialog also does not appear and the report is generated correctly. All of the parameters are set using ParameterFields and they are set before the ReportSource is set.

Looking through the .NET API documentation it seems like the CrystalReportViewer should have an "EnableParameterPrompt" property that would do what I want however it doesn't seem to be a valid parameter as I get compile errors when I try to use it... Not sure if it matters or not but I am using managed C++ and our application is built using Visual Studio 2005. Could that maybe have something to do with it?

Thanks,

-Ben

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

OK, I'm going to answer my own question as with a little more digging I was able to find out that I needed to set some stuff on the report document to specify that there are no values. Still not sure why "EnableParameterPrompt" is not valid for me though as it seems like that would work as well. At any rate here is what I needed to do:

ReportDocument->ParameterFields[<Optional Parameter Name>]->CurrentValues->Clear();

ReportDocument->ParameterFields[<Optional Parameter Name>]->CurrentValues->IsNoValue = true;

-Ben

Answers (0)