多个值赋给Crystal Reports中的参数 [英] Assign multiple values to a parameter in Crystal Reports

查看:121
本文介绍了多个值赋给Crystal Reports中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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}

这篇关于多个值赋给Crystal Reports中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆