Crystal Reports如果有任何记录符合条件,则退出公式

时间:2014-06-23 18:34:56

标签: crystal-reports

我希望创建一个读取每条记录的公式,如果满足某个条件,则公式将停止读取记录并返回特定标签。我尝试了以下代码,并在详细级别显示正确的结果,但不显示页脚。它似乎是"退出"并不是真的有用。谢谢你的帮助!

当前代码(我已在报告页脚中添加):

shared stringvar label := "";  
local numbervar i;  
for i := 1 to {#Count_Records} do  
    (
    if ({report_data.return_code}[i] = "defective-exchange" 
        or {report_data.return_code}[i] = "defective") then  
            label := "Defective-Exchange Only";  
            exit for;
    );  
if label = "" then  
    label:="Pickup Credit Memo";  

label;  

1 个答案:

答案 0 :(得分:0)

要消除数据,请使用记录选择公式:

{report_data.return_code} = "defective-exchange" or {report_data.return_code} = "defective"

要格式化数据,请使用公式字段:

// {@Return Code}
if {report_data.return_code} = "defective-exchange" or {report_data.return_code} = "defective" then
  "Defective-Exchange Only"
else if {report_data.return_code} = "" then
  "Pickup Credit Memo"
else
  "something else"