多个值赋给Crystal Reports中的参数多个、参数、Crystal、Reports

2023-09-03 03:59:13 作者:滚。

我添加了一个参数,我与选项报告允许多个值选中。

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

这是一个状态栏(IE,建议,进行中,已完成,已取消),我希望用户能够选择哪些(和多少)的不同OrderStatus汇报。

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);
}

我已经检查它添加值到OrderStatus参数,但报告运行时,CrystalReports对话框弹出,并要求我输入值的OrderStatus参数。如此看来好像值不是COMMITED的参数。我已经做了一些搜索和无法弄清楚,为什么它不工作。

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.

谢谢

推荐答案

刚刚设置的参数值整数数组。

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}