Crystal Reports - 是否可以通过参数将操作符传递给报表?

时间:2013-05-23 08:32:49

标签: parameters crystal-reports report operator-keyword

我似乎无法找到解决方案。 我一直在使用Crystal Reports 2011中的参数(也在v10中),并想知道是否可以通过参数将操作符传递给报表。

E.g

我创建了一个报告,显示各自群组中的帐号数量。

  

组名.....计数

     

A组................ 5

     

组B ............... 10

     

C组............... 20

我有一个名为'Val'的参数与计数有关,一个名为'Operator'的参数包含不同的运算符(>,<,=等)

在运行时,我希望用户选择运算符和值来缩小其结果范围,但我无法创建一个选择标准:

DistinctCount ({customers.account} {customers.type){?operator}{?val}

所以理论上,用户可以输入以下内容(通过参数):

DistinctCount ({customers.account} >= 10

有没有人有任何想法如何实现这一目标? 此外,如果您需要我提供的任何信息,请给我一个大喊。

1 个答案:

答案 0 :(得分:1)

据我所知,你只能通过长选择记录公式来做到这一点,例如:

Select Case {@Operator}

Case "=" :
    (If (DistinctCount ({customers.account} = 10)) then true else false)
Case ">" :
    (If (DistinctCount ({customers.account} > 10)) then true else false)
Case "<" : 
    (If (DistinctCount ({customers.account} < 10)) then true else false)
Case ">=" :
    (If (DistinctCount ({customers.account} >= 10)) then true else false)
Case "<=" :
    (If (DistinctCount ({customers.account} <= 10)) then true else false)
Default : false