【问题标题】:Error on RDLC ExpressionRDLC 表达式错误
【发布时间】:2015-09-22 16:43:18
【问题描述】:

我正在使用这个 exp 来计算在 RDLC 报告上支付的总费用:

=Sum(IIf(Fields!ResponseDescription.Value ="Approved Successful",Int(Fields!Amount.Value), 0))

我在结果列中得到#ERROR,这可能是什么问题? .

上面类似的 Exp 工作正常:

=Sum(IIf(Fields!ResponseDescription.Value <> "",Int(Fields!Amount.Value), 0))

几点说明:

1- Amount 始终是 INTEGER 并且存在。

2- ResponseDescription 始终是 STRING 并且存在。

谢谢

【问题讨论】:

    标签: visual-studio-2010 rdlc


    【解决方案1】:

    你可以使用这个表达式:

    =Sum(CInt(IIf(Fields!ResponseDescription.Value ="Approved Successful", Fields!Amount.Value, 0)))
    

    您必须在聚合之前将所有可能的值转换为相同的类型。

    我认为第二个表达式可以正常工作,因为您始终处于 True 情况下 (Fields!ResponseDescription.Value &lt;&gt; ""),因此它始终使用已转换为 Integer 的表达式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多