简体   繁体   中英

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. 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:

=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. I have the "failed to compile" indicator in the expression builder, and the result in the report is #Error .

How do I fix my IsNothing() expression? What did I misunderestimatestand?

ETA: Perhaps this has to do with the fact that the expression runs in VB and does not short-circuit?

ETA2: I dropped the field prior_supplier into a textbox just to make sure. The resulting expression =Fields!prior_dod_supplier.Value also failed to compile. :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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM