Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS - Checking whether the data is null

I've the following expression in my report.

=FormatNumber(MAX(Fields!Reading.Value, "CellReading_Reading"),3) 

Now when the dataset is empty 'Fields!Reading.Value' becomes empty and finding their maximum is invalid. How can i check if the entire column is empty?

I tried the following with no luck.

=iif(IsNothing(Fields!.Reading.Value),"",FormatNumber(MAX(Fields!Reading.Value, "CellReading_Reading"),3)) 

But still i'm getting #Error in the report. I also checked out link and was not able to get a clue from it. I want to handle it in the report level.

like image 910
NLV Avatar asked Mar 18 '10 09:03

NLV


People also ask

How do you check if a value is NULL in SSRS?

How to check if a parameter is NULL in SSRS? The IsNothing() function returns True if the Paramter value is NULL , otherwise it will return FALSE.

Is NULL parameter in SSRS?

In SSRS a multi-value parameter cannot include a NULL value, so users can't filter the data for NULL values.

How do you handle ISNull in SSRS expression?

If we are getting the data from a Database, we can use ISNull or COALESCE function to replace Null values with values we would like. But if we want to replace the Null/Blank values in SSRS Report, we need to use IIF and Isnothing functions in expressions.


2 Answers

try like this

= IIF( MAX( iif( IsNothing(Fields!.Reading.Value ), -1, Fields!.Reading.Value ) ) = -1, "",  FormatNumber(  MAX( iif( IsNothing(Fields!.Reading.Value ), -1, Fields!.Reading.Value ), "CellReading_Reading"),3)) ) 
like image 84
IordanTanev Avatar answered Sep 23 '22 14:09

IordanTanev


Or in your SQL query wrap that field with IsNull or Coalesce (SQL Server).

Either way works, I like to put that logic in the query so the report has to do less.

like image 26
Mozy Avatar answered Sep 22 '22 14:09

Mozy