views:

1592

answers:

3

I have added a parameter to my report with the option "Allow Multiple Values" checked.

This is a status column (IE, Proposed, In Progress, Completed, Canceled), and I want the user to be able to select which (and how many) different OrderStatus to report on.

How I normally set parameters is:

report.SetParameterValue("@dtBegin", dtBegin.DateTime);

What I tried to do for the multiple values was something like this:

//pseudo loop
foreach(int intOrderStatus in intSelectedOrderStatuses)
{
    report.Parameter_OrderStatus.CurrentValues.AddValue(intOrderStatus);
}

I have checked it does add the values to the OrderStatus parameter, but when the report runs, the CrystalReports dialog pops up and asks me to enter values for the OrderStatus parameter. So it seems as though the values aren't "commited" to the parameter. I have done a number of searches and can't figure out why it's not working.

Thanks,

A: 

Have you set the parameter to Hidden in the Crystal Reports parameter options?

Rich.Carpenter
No I haven't. Where do I set this option? Also why would the Hidden option resolve my issue?
Nathan Koop
Bah. Please disregard this answer. I was thinking about Reporting Services reports, not Crystal. Apologies.
Rich.Carpenter
+2  A: 

Just set the parameter value with an array of ints.

report.SetParameterValue("@OrderStatus", new int[]{1,2,3});

in the select expert you would use the in operator.

{table.order_status_id} in {?@OrderStatus}
dotjoe
+1 I wasn't aware that you could pass in an array of ints like this. Haven't tried it, but I'll assume that it works. :)
Dusty
A: 

I haven't tried this, but I think that you should be able to add intOrderStatus to either a ParameterDiscreteValue or ParameterRangeValue and pass that into Parameter_OrderStatus.CurrentValues instead of intOrderStatus.

Dusty