使用if语句不断在基本语法上出错

时间:2019-05-13 15:12:33

标签: crystal-reports formula

验证公式时,我不断收到以下错误消息。这是有关基本语法的水晶报告:

  

在这里需要声明。

代码:

if {?Pm-?dropdown_Barcodes} = "Prep" Then ({JobOperations.jmoProcessID} in ("BOELE","BOEHY","BOPRA","BOPRS"))
else 
if {?Pm-?dropdown_Barcodes} = "Main" then ({JobOperations.jmoProcessID} not in 
("BOELE","BOEHY","BOPRA","BOPRS"))
else
if {?Pm-?dropdown_Barcodes} = "All" then "All"

enter image description here

1 个答案:

答案 0 :(得分:0)

如果不应该以这种方式声明语句,则语法错误。

尝试一下:

if {?Pm-?dropdown_Barcodes} = "Prep" and ({JobOperations.jmoProcessID} in ("BOELE","BOEHY","BOPRA","BOPRS"))
then {JobOperations.jmoProcessID}
else 
if {?Pm-?dropdown_Barcodes} = "Main" and not({JobOperations.jmoProcessID} in 
("BOELE","BOEHY","BOPRA","BOPRS"))
then {JobOperations.jmoProcessID} 
else
if {?Pm-?dropdown_Barcodes} = "All" then "All"

编辑---------------------------------------------- -------------------

 if {?Pm-?dropdown_Barcodes} = "Prep" and ({JobOperations.jmoProcessID} in ("BOELE","BOEHY","BOPRA","BOPRS"))
    then Formula = {JobOperations.jmoProcessID}
    elseif {?Pm-?dropdown_Barcodes} = "Main" and not({JobOperations.jmoProcessID} in 
    ("BOELE","BOEHY","BOPRA","BOPRS"))
    then Formula ={JobOperations.jmoProcessID} 
    elseif {?Pm-?dropdown_Barcodes} = "All" 
then Formula ="All"
end if