balaweblog
balaweblog

Reputation: 15460

SSRS Reports - parameter query

I have an SQL reporting server report which has 5 parameters which permit nullable values. The user may enter values for any of the fields. I need to enforce the condition that the user must enter at least one out of five parameter values (any one is required).

****Note**: I need to do this in SQL Server reports itself.**

Upvotes: 1

Views: 2860

Answers (1)

Ray
Ray

Reputation: 46555

What would you like to do if you detect they haven't entered any values?

You code write some code for the report (Report Menu -> Properties -> Code). The code would check to see if at least one of your parameters is not null. Then you could use that code to show or hide a textbox to display a message.

Same code:

Public Function CheckForNoParameters(Param1 As String, Param2 As String, Param3 As String) As Boolean
    CheckForNoParameters = (Param1 = Nothing)  AND (Param2 = Nothing) AND (Param3 = Nothing)
End Function

Then in the hidden expression of your box:

=Not Code.CheckForNoParameters(Parameters!Report_Parameter_0.Value, Parameters!Report_Parameter_1.Value, Parameters!Report_Parameter_2.Value)

Upvotes: 2

Related Questions