all groups > sql server reporting services > september 2004 >
You're in the

sql server reporting services

group:

Optional Paramater


Optional Paramater mistybrian
9/19/2004 5:19:01 PM
sql server reporting services: I have a query with one paramater (a date field). I would like the paramater
to be optional... if no date is entered, then all records are returned. How
would I accomplish this?

Re: Optional Paramater RK Balaji
9/19/2004 8:40:22 PM
You can 'Allow Nulls' or 'Allow Blank' on that parameter and use a
conditional IIF statement in the SQL..

[quoted text, click to view]

Re: Optional Paramater mistybrian
9/19/2004 9:17:02 PM
I have tried this, but I must be doing it wrong because I get no records
returned.

On the Data page, I am filtering the query column "odConvYear" using a "?".

Under dataset parameters, I have the parameter name as "?" and the value as...

=iif(Parameters!Parameter1.Value = "",""," WHERE odConvYear =
:Parameters!Parameter1" )

And, finally, under Report Parameters, I have the name as "Parameter1" and I
have checked "Allow null values."

This returns no records, with an entry or not.

Any ideas what I'm doing wrong?









[quoted text, click to view]
Re: Optional Paramater mistybrian
9/20/2004 8:49:06 AM
This if statement returns no records on a Null entry and I get no records and
an error when I put in an entry...

The value expression for the query parameter ‘?’ contains an error: Input
string was not in a correct format.


Just to double check, if their is no entry for the report parameter, I want
all records returned. Am I on the right track with this?

Thanks!


[quoted text, click to view]
Re: Optional Paramater mike
9/20/2004 9:26:45 AM
=iif(Parameters!Parameter1.Value = "",""," WHERE odConvYear = " +
Parameters!Parameter1.Value)


[quoted text, click to view]

AddThis Social Bookmark Button