on ‎2025 Sep 02 2:14 PM
Hello, hopefully someone can assist
We are enountering the error "Missing parameter values" when exporting a report document. The report in question has 60 parameters and I have double checked and triple checked the parameters and made sure a value is supplied for all of them, but still get this error.
Is there any functionality in CrystalDecisions that identifies which parameter this error is relating to?
Or is there anything else that might be causing this error even when a value is provided for all parameters?
Stack trace:
Reading records
Reading records - Complete
Compiling report
Compiling report – Complete
Records Selected: 19
Exporting report
Exporting report - Complete
CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter values.
---> System.Runtime.InteropServices.COMException: Missing parameter values.
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at Monitor.Fep.Application.ReportGateway.ReportProcessorCrystalDecisions.DoReport()
at Monitor.Fep.Application.ReportGateway.ReportProcessor.FetchReport(String documentKey)
Gateway processing the response for document key of: 3_638908609542889837
Additional context
Our application is writting in C#
The report file in question was created using SAP Crystal Reports 2020 desktop application
The report uses a Command to retrieve the data. The command executes a single procedure, and the input parameters for said procedure are filled out using the command parameters
e.g.
EXECUTE PROCEDURE my_proc({?Parameter1}, {?Parameter2}, {?Parameter3})
etc.
The parameters are of several different types: Integers, Strings, Booleans etc.
Request clarification before answering.
In your application you must set the parameter values first and the call the logon to the DB routine.
Other causes could be due to the value type is wrong, try single stepping through your code to see if any exceptions are thrown.
Also use the Try/catch when setting the values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can find the API Reference material here:
Looking at your log id indicates the export is complete but then throws the parameter exception.
Not clear if it's a CR Parameter error or possibly due to some API you are calling, CR or other parameter?
Here's an example of how I set parameter values and export to stream could be the cause:
//CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
ISCDReportClientDocument rcd;
//rpt.Load("c:\\Reports\\Group.rpt");
rcd = rptClientDoc;
// Declare a PrintOutputController to allow documents to be exported to PDF
PrintOutputController rasPrintOutputController;
CrReportExportFormatEnum rasReportExportFormat;
CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();
//CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions PDFExpOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
//diskOpts.DiskFileName = "d:\\reports1.pdf";
//PDFExpOpts.FormatOptions = CreateBookmarksFromGroupTree = true;
//PDFExpOpts.FirstPageNumber = 1;
//PDFExpOpts.LastPageNumber = 1;
//PDFExpOpts.UsePageRange = true;
//rcd.PrintOutputController.ExportEx(PDFExpOpts);
// Set the CrReportExportFormatEnum to export the report as a PDF file.
rasReportExportFormat = CrReportExportFormatEnum.crReportExportFormatPDF;
//rasReportExportFormat = CrReportExportFormatEnum.crReportExportFormatCharacterSeparatedValues;
rasPrintOutputController = rcd.PrintOutputController;
// Use the Export() method of the PrintOutputController to export the report to a ByteArray.
ByteArray tempByteArray = rasPrintOutputController.Export(rasReportExportFormat, 0);
Byte[] byteStreamOutput = tempByteArray.ByteArray;
System.IO.Stream oStream;
byte[] byteArray = null;
oStream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
//oStream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.CharacterSeparatedValues);
byteArray = new byte[oStream.Length];
oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
// this is used to verify the file so I saved it to disk
try
{
System.IO.File.Create(diskOpts.DiskFileName, Convert.ToInt32(oStream.Length - 1)).Close();
}
catch (Exception ex)
{
btnSQLStatement.Text = "Create ERROR: " + ex.Message;
//return;
}
try
{
string outputFileName = "";
string MyRptName = rpt.FileName.ToString();
outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
outputFileName = outputFileName.Substring(0, (outputFileName.Length - 4)) + "1.pdf";
System.IO.File.OpenWrite(diskOpts.DiskFileName).Write(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
System.IO.File.SetAttributes(diskOpts.DiskFileName, System.IO.FileAttributes.Directory);
oStream.Close();
}
catch (Exception ex)
{
btnSQLStatement.Text = "Write ERROR: " + ex.Message;
//return;
}Maybe that will help you determine what's generating the error.
It likely is due to the value type and how you are defining it in code, using the correct conversion type.
A Try/catch for each value should indicate if there is a format type causing the exception. Maybe add a counter to indicate which parameter is being set.
Sorry I can't be of more help, you need to do more debugging and single stepping through your code to try catching where the exception is being thrown...
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.