SQL Server Report Builder 2012 中的 Iif 函数
Iif function in SQL Server Report Builder 2012
=IIf((First(Fields!CustomerCountry.Value, "Invoice"))<>(First(Fields!SupplierCountry.Value, "Invoice"))),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value)))
我正在 Microsoft SQL Server Report Builder 中开具自动发票,但我被增值税卡住了(本例中为 BTW 参数)。如果客户与供应商不是来自同一个国家,则他不应缴纳增值税。如果是,他应该缴纳增值税。我在想我缺少一个括号(或者有太多的括号)。我对 SQL 很陌生,所以我无法自己弄清楚。
这是弹出的错误:textrun 'Textbox16.Paragraphs[0].TextRuns[1]' 的值表达式包含错误:[BC30455] 未指定参数'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object' 的参数 'FalsePart'。
正如错误所说,IIF
函数无法找到 FalsePart
,这是由于括号错位而发生的(是的,您猜对了)。
下面的代码经过更正 - 虽然未经过测试
=IIf((First(Fields!CustomerCountry.Value,"Invoice"))<>(First(Fields!SupplierCountry.Value,"Invoice")),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value))))
=IIf((First(Fields!CustomerCountry.Value, "Invoice"))<>(First(Fields!SupplierCountry.Value, "Invoice"))),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value)))
我正在 Microsoft SQL Server Report Builder 中开具自动发票,但我被增值税卡住了(本例中为 BTW 参数)。如果客户与供应商不是来自同一个国家,则他不应缴纳增值税。如果是,他应该缴纳增值税。我在想我缺少一个括号(或者有太多的括号)。我对 SQL 很陌生,所以我无法自己弄清楚。
这是弹出的错误:textrun 'Textbox16.Paragraphs[0].TextRuns[1]' 的值表达式包含错误:[BC30455] 未指定参数'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object' 的参数 'FalsePart'。
正如错误所说,IIF
函数无法找到 FalsePart
,这是由于括号错位而发生的(是的,您猜对了)。
下面的代码经过更正 - 虽然未经过测试
=IIf((First(Fields!CustomerCountry.Value,"Invoice"))<>(First(Fields!SupplierCountry.Value,"Invoice")),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value))))