Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
50.1k views
in SQL Server Reporting Services by 12 12 19
edited by

In SSRS, I have a report with a parameter that allows NULL values to filter my report, I am trying to use IIF expression to check if a parameter is NULL OR EMPTY in SSRS.

=IIF(Parameters!Name.Value="",Nothing,Parameters!Name.Value)

The above IIF expression works properly if the parameter value is empty but it doesn't work if the parameter is NULL!

Please, I need to know What's the best way I should use to check if a parameter is NULL OR EMPTY in SSRS?


1 Answer

1 like 0 dislike
by 158 185 373
selected by
 
Best answer

How to check if a parameter is NULL in SSRS?

To check if a parameter is NULL in SSRS, you have to use IsNothing() function as shown below:

=IIF(IsNothing(Parameters!Name.Value),True,False)

The IsNothing() function returns True if the Paramter value is NULL , otherwise it will return FALSE.

How to check if a parameter is BLANK in SSRS?

To check if a parameter is BLANK or EMPTY in SSRS, you have two options:

Option1: Using Len function, to check the count of string as below

=IIF(Len(Parameters!Name.Value)=0,True,False)

Option2: simply, check if the value is equal to ""

=IIF(Parameters!Name.Value="",True,False)

How to check if a parameter is NULL or BLANK in SSRS?

In your case, I would suggest using the below expression to check if a parameter is NULL OR EMPTY in SSRS.

=IIF((IsNothing(Parameters!Name.Value)=True) OR
(Parameters!Name.Value=""),Nothing,Parameters!Name.Value)
If you don’t ask, the answer is always NO!
...