简体   繁体   English

我正在将 Crystal 报表转换为 SSRS 报表。 需要用多个 arguments 转换一个 IIF 表达式

[英]I am converting Crystal reports to SSRS reports. Need to convert an IIF expression with multiple arguments

I need to convert an expression with multiple arguments.我需要用多个 arguments 转换一个表达式。 Below is the crystal expression下面是水晶表达式

if Sum ({t_bol_cartons.no_of_cartons}, {t_bol_cartons.hu_id}) = 0 and {t_bol_cartons.sub_status} <> 'S' and {t_bol_cartons.loaded} <> 0 then 1 else if Sum ({t_bol_cartons.no_of_cartons}, {t_bol_cartons.hu_id}) = 0 and {t_bol_cartons.loaded} = 0 then 0 ELSE Sum ({t_bol_cartons.no_of_cartons}, {t_bol_cartons.hu_id}) if Sum ({t_bol_cartons.no_of_cartons}, {t_bol_cartons.hu_id}) = 0 and {t_bol_cartons.sub_status} <> 'S' and {t_bol_cartons.loaded} <> 0 then 1 else if Sum ({t_bol_cartons.no_of_cartons}, { t_bol_cartons.hu_id}) = 0 和 {t_bol_cartons.loaded} = 0 然后 0 ELSE 总和 ({t_bol_cartons.no_of_cartons}, {t_bol_cartons.hu_id})

I have converted in SSRS as below我已在 SSRS 中转换如下

IIf((Fields,no_of_cartons + Value.Fields.hu_id.Value = 0) AND (Fields,sub_status,Value <> "S") AND (Fields.loaded.Value <> 0)."1", IIf((Fields,no_of_cartons.Value + Fields.hu_id.Value = 0) AND (Fields!loaded.Value = 0),"0", (Fields!no_of_cartons.Value + Fields!hu_id.Value))) IIf((Fields,no_of_cartons + Value.Fields.hu_id.Value = 0) AND (Fields,sub_status,Value <> "S") AND (Fields.loaded.Value <> 0)."1", IIf((Fields ,no_of_cartons.Value + Fields.hu_id.Value = 0) AND (Fields!loaded.Value = 0),"0", (Fields!no_of_cartons.Value + Fields!hu_id.Value)))

I am getting an error as "The Value expression for the textrun 'Sum_cont.Paragraphs[0].TextRuns[0]' contains an error: [BC30516] Overload resolution failed because no accessible 'IIf' accepts this number of arguments."我收到一个错误,因为“textrun 'Sum_cont.Paragraphs[0].TextRuns[0]' 的值表达式包含错误:[BC30516] 重载解析失败,因为没有可访问的 'IIf' 接受此数量的 arguments。” Please could anyone help with this?请问有人可以帮忙吗? Thank you.谢谢你。

The is first part is wrong, you have Fields!no_of_cartons + Value instead of Fields.no_of_cartons.Value第一部分是错误的,你有Fields!no_of_cartons + Value而不是Fields.no_of_cartons.Value

Try尝试

IIf(
  (Fields!no_of_cartons.Value + Fields!hu_id.Value = 0) AND (Fields!sub_status.Value <> "S") AND (Fields!loaded.Value <> 0),
  "1", 
  IIf(
      (Fields!no_of_cartons.Value + Fields!hu_id.Value = 0) AND (Fields!loaded.Value = 0),
      "0",
      (Fields!no_of_cartons.Value + Fields!hu_id.Value)
      )
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM