Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

"Missing parameter values." Error when setting record selection formula

Setup - VS 2008, CR 2008 (v12.0), Win XP & C#.Net

I have a form which loops through all parameters (non-linked to sub reports, so only off the main report) and allows users to enter the values for each parameter. When hitting the preview button, I loop through all of the saved values, set the parameter field values and then add any additional filters into the recordselection formula as below. The problem i'm having is that the ReportDocument.HasRecords returns true if the ReportDocument.RecordSelectionFormula doesn't filter out every result.

For example, I have a list of customers and if I set the selection formula to filter out a specific customer, ReportDocument.HasRecors returns true, if I set the selection formula to filter something that doesn't exist i.e. customer "xk39df", the moment this line of code runs "ReportDocument.RecordSelectionFormula = rsFormula;" - ReportDocument.HasRecors returns the following exception as opposed to "False".

Message: Missing parameter values.

Source: CrystalDecisions.ReportAppServer.DataSetConversion

StackTrace: at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.hasRecords()

at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_HasRecords()

ErrorID: MissingParameterFieldCurrentValue

The strange thing is, it works fine if the recordselectionformula selects a record which exists in the results - all parameters have a current value except for the linked parameters.

This one has got me stumped!

foreach (ParameterFieldDefinition parameterField in ReportDocument.DataDefinition.ParameterFields)
                var query = ReportObjects.Values.Cast<Filters>().Where(objects => objects.ParameterName == parameterField.Name.ToUpper().Trim());

                foreach (var item in query)
                    parameterField.ApplyMinMaxValues(item.MinLength, item.MaxLengh);

            var records = ReportObjects.Values.Cast<Filters>().Where(recordSelection => recordSelection.RecordSelectionFormula.Trim().Length != 0);

            foreach (var item in records)
                rsFormula += item.RecordSelectionFormula;

            if (rsFormula.EndsWith(" AND "))
                rsFormula = rsFormula.RTrim(5);

            ReportDocument.RecordSelectionFormula = rsFormula;

Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question