好的,所以我想在reportviewer的这个IIF语句中做数学。但是,它所做的只是在我的字段中返回FALSE。我能用IIF声明做数学还是什么?
=IIF(
UCase(Fields!Tax.Value) = "YES",
Variables!DeptTotal.Value =+(Fields!TotalPriceWithoutTax.Value * (1 + Parameters!Tax.Value)),
Variables!DeptTotal.Value =+ (Fields!TotalPriceWithoutTax.Value)
)
任何想法?提前谢谢。
编辑:
好的伙计们,
我甚至做了自定义代码,但仍然返回false。
Public Function Taxable(Answer AS String, DepartTotal AS Decimal, TotalWithoutTax AS Decimal, Tax AS Decimal) AS Decimal
If UCase(Answer) = "YES" Then
DepartTotal += TotalWithoutTax * Tax
Else
DepartTotal += TotalWithoutTax
End If
Return DepartTotal
End Function
还有其他任何建议吗?
再次感谢。
编辑:
这是我的应税函数调用:
=Code.Taxable(Tax, DepartTotal, TotalWithoutTax, txtTax.value)
答案 0 :(得分:0)
UCase(Fields!Tax.Value)=“YES”,Tax.value可能返回false和true或0和1, 再试一次 祝你好运。
答案 1 :(得分:0)
试试这个:将=+
更改为+=
更改
Variables!DeptTotal.Value =+(Fields!TotalPriceWithoutTax.Value * (1 + Parameters!Tax.Value))
到
Variables!DeptTotal.Value += (Fields!TotalPriceWithoutTax.Value * (1 + Parameters!Tax.Value))
答案 2 :(得分:0)
这是修复:
功能:
Public Function Taxable(Answer AS String, TotalWithoutTax AS Decimal, Tax AS Decimal) AS Decimal
Dim total AS Decimal = 0
If UCase(Answer) = "YES" Then
total = TotalWithoutTax * (1 + Tax)
Else
total = TotalWithoutTax
End If
Return total
End Function
电话:
Code.Taxable(Fields!Tax.Value, Sum(Fields!TotalPriceWithoutTax.Value), Parameters!Tax.Value)