Crystal 报告记录过滤每条记录 3 种不同的方式 CR10

Crystal Report Record Filtering 3 different ways per record CR10

我在 crystal 报告中使用命令查询来提取我需要的信息。 查询结果如下所示:

Amt      Date      Acc     Unit     Setup     Owner?     Owner
5.00  2016-03-01    1       A        A          Y          B
5.00  2016-03-01    2       A        B          N          null
5.00  2016-03-01    3       A        null       null       null

我的逻辑流程是:如果Owner? = "Y" then get the owner, else if the owner? = "N" or isnull,则获取设置,否则如果设置为空,则获取单位。

在记录选择中,我尝试了一个 if-else-if 语句来帮助过滤每条记录,看起来像这样只得到 "B" 个单位。:

If({Command.Owner? = "Y") Then {Command.Owner = "B")
Else if ({Command.owner? = "N" or isnull({Command.owner}) Then
     {Command.setup = "B")
Else if ({Command.owner? = "N" or isnull({Command.owner}) AND {command.setup} <> "B" Then
 {Command.unit} = "B"

基本上,这是在检查 Owner?是Y然后获取所有者为B的记录,如果是N或null,则获取设置为B的记录,如果两者都不正确则获取单位为B.

但它并没有得到每条记录。我希望能够获得与此相关的所有记录。喜欢

Amt      Date      Acc     Unit     Setup     Owner?     Owner
5.00  2016-03-01    1       A        A          Y          B
5.00  2016-03-01    2       A        B          N          null
5.00  2016-03-01    3       B        null       null       null

都有效returns,但记录选择只抓取符合第一个条件的记录,然后忽略其余的。

我已经尝试过使用 AND 语句而不是 Else 的相同 if-else-if,但是 returns 什么都没有。我也对 OR 做了同样的事情,returns 什么都没有。

有没有办法搜索每条记录,如果它符合其中一个条件,然后将其拉出并显示?

试试这个(针对空序列进行编辑)?

If (isnull({Command.owner}) or {Command.owner?} = "N") and not isnull({Command.setup} and {Command.Owner?} <> "Y") then {Command.setup} = "B"
Else if {Command.Owner?} = "Y" Then {Command.owner} = "B"
Else {Command.unit} = "B"