Params in Crystal Report

D

Dominik Tropper

Dear all

I have created a c# web project in VS.NET 2003 that contains a crystal
report with two params. No problems until here, but executing the report
selects the wrong records.

My params are called {?PNumber} and {?PName} building a logical AND. They
are defined as 'Discrete and Range Values' with the option 'Allow multiple
values' checked. The following code snipped shows what's going on:

// load report
ReportDocument rd = new ReportDocument();
rd.Load("myReport.rpt");
ParameterDiscreteValue crDiscreteValue;
ParameterRangeValue crRangeValue;
ParameterFieldDefinition crParameter;
ParameterValues crParameterValues = new ParameterValues();
// first param
crParameter = rd.DataDefinition.ParameterFields["PNumber"];
crRangeValue = new ParameterRangeValue();
crRangeValue.StartValue = 200000;
crRangeValue.EndValue = 999000;
crParameterValues.Add(crRangeValue);
// second param
crParameter = rd.DataDefinition.ParameterFields["PName"];
crDiscreteValue = new ParameterDiscreteValue();
crDiscreteValue.Value = "LongTermWatch";
crParameterValues.Add(crDiscreteValue);
// assign params
crParameter.ApplyCurrentValues(crParameterValues);

The resultset should contain only one row, fulfilling the conditions
{?PNumber} between 200000 and 999000 and {?PName} = "LongTermWatch". Instead
the resultset shows even records whos {?PNumber} begins with 200...

And what do I have to do if I use only one of the params, say {?PNumber} =
199210, ignoring the value of {?PName}? Because of the logical AND the
resultset would be empty...

Thanks in advance
Dominik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top