[英]IsNothing() in VS2012 SSRS report causes an error
I am making an RDLC report in VS 2012 (ASP.net, C#) and trying to show a yes/no field. 我正在VS 2012(ASP.net,C#)中制作RDLC报告并尝试显示是/否字段。 Our test data has nulls in this field, which I want to show as a no.
我们的测试数据在此字段中为空,我想将其显示为否。 According to all the research I've found (including SO), the code for this is:
根据我发现的所有研究(包括SO),其代码为:
=iif( IsNothing(Fields!prior_supplier.Value), "No", iif(Fields!prior_supplier.Value = "Y", "Yes", "No"))
(This will appear on the report as: "Did we use this supplier before? No" .) (这将在报告中显示为: “我们之前是否使用过该供应商?否” 。)
However, the contents of the IsNothing() call keep erroring out. 但是,IsNothing()调用的内容不会出错。 I have the "failed to compile" indicator in the expression builder, and the result in the report is #Error .
我在表达式构建器中有“编译失败”指示符,报告中的结果是#Error 。
How do I fix my IsNothing() expression? 如何修复我的IsNothing()表达式? What did I misunderestimatestand?
我误解了什么?
ETA: Perhaps this has to do with the fact that the expression runs in VB and does not short-circuit? ETA:也许这与表达式在VB中运行并且不会短路这一事实有关?
ETA2: I dropped the field prior_supplier into a textbox just to make sure. ETA2:我将字段prior_supplier放入文本框中以确保。 The resulting expression
=Fields!prior_dod_supplier.Value
also failed to compile. 结果表达式
=Fields!prior_dod_supplier.Value
也无法编译。 :confused: :困惑:
I changed the field in the view to the expression 我将视图中的字段更改为表达式
ISNULL(prior_supplier, 'N') AS prior_supplier
Then used in the report the expression 然后在报告中使用表达式
=iif(Fields!prior_supplier.Value = "Y", "Yes", "No")
This solved the #Error issue. 这解决了#Error问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.