Reputation: 3511
I am using SSRS 2008 R2. My RDL has several subreports in it which all take one field value only from this parent RDL as their inputs. This one field value is called "people_id". There are some instances though where there are 0 records returned from the parent RDL. When this happens, I get the following error when I run this report from the parent RDL:
An error occurred during local report processing. Object reference not set to an instance of an object.
Even though I tried setting the paremeter value for my subreports to both:
people_id
and
=iif(isnothing(Fields!people_id.Value),"",Fields!people_id.Value)
How can I successfully avoid this error when there are no records?
Upvotes: 0
Views: 2922
Reputation: 11
I guess it's too late but in case of helping anyone else.
Some values in an expression can evaluate to null or undefined at report processing time. This can create run-time errors that result in #Error displaying in the text box instead of the evaluated expression. The IIF function is particularly sensitive to this behavior because, unlike an If-Then-Else statement, each part of the IIF statement is evaluated (including function calls) before being passed to the routine that tests for true or false. The statement =IIF(Fields!Sales.Value is NOTHING, 0, Fields!Sales.Value) generates #Error in the rendered report if Fields!Sales.Value is NOTHING.
From http://msdn.microsoft.com/en-us/library/ms157328.aspx
I had a similar issue and ened up with writing a custom function.
Upvotes: 1
Reputation: 2186
Instead of =iif(isnothing(Fields!people_id.Value),"",Fields!people_id.Value), can you try =iif(isnothing(Fields!people_id.Value),NOTHING,Fields!people_id.Value)?
Upvotes: 0