首页 > 解决方案 > 将数字转换为货币时,SSRS 报告显示 #Error

问题描述

我试图让报告显示用户在参数中输入的购买价格。如果用户没有输入任何内容,它将显示“未公开”,否则我希望它以货币形式显示购买价格。我尝试了以下方法:

=IIF(Parameters!PurchasePrice.Value = "", "Undisclosed", Cstr(Format(Parameters!PurchasePrice.Value, "C")))

=IIF(Parameters!PurchasePrice.Value = "", "Undisclosed", Format(Parameters!PurchasePrice.Value, "C"))

=IIF(Parameters!PurchasePrice.Value = "", "Undiscloded", FormatCurrency(Parameters!PurchasePrice.Value,0))

=IIF(Parameters!PurchasePrice.Value = "", "Undiscloded", FormatNumber(Parameters!PurchasePrice.Value,0))

我可以让“未公开”出现,但每次我输入一个数字时它都会显示#Error

标签: reporting-services

解决方案


您可以尝试以下解决方案:

 =IIF(IsNumeric(Parameters!PurchasePrice.Value), Format(Val(Parameters!PurchasePrice.Value), "C"), "Undisclosed")

推荐阅读