Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 "Parameter is missing a value" when no query resul

Author  Topic 

bobzor
Starting Member

10 Posts

Posted - 2010-10-25 : 16:45:58
I need to display an "As-Of" date in the page heading for several reports. Since I don't have access to the fields in the dataset at that point, I'm using a parameter named 'hAsOfDate'. Data type is String.

If I get at least one row back from the query, everthing is fine. If there are no results, a message saing "The 'hAsOfDate' parameter is missing a value" shows in the web UI. What I want is to just show the page header/footer with no detail.

The 'hAsOfDate' parameter is Internal, and it allows nulls and blanks. The "Available Values" for 'hAsOfDate' are "From Query", with a field which comes from the dataset used by the report. I've tried various things for the Default values. I'm currently using "From Query". Non-query and null don't help.

I've tried various defensive programming to set the value of the Textbox that displays the parameter, but to no avail. Here's my latest:
=IIF(IsNothing(Parameters!hAsOfDate), "NO DATA MATCHES GIVEN PARAMETERS", IIF(IsDate(Parameters!hAsOfDate.Value), "As of: " + FormatDateTime(Parameters!hAsOfDate.Value, DateFormat.ShortDate), "NO VALID AS-OF DATE PROVIDED"))

HELP!

kwymore
Starting Member

2 Posts

Posted - 2010-10-26 : 09:23:17
Can you use the NoRows property on the table in the designer to set a default message of "No data matches given parameters"?
Go to Top of Page

bobzor
Starting Member

10 Posts

Posted - 2010-10-27 : 10:30:31
quote:
Originally posted by kwymore

Can you use the NoRows property on the table in the designer to set a default message of "No data matches given parameters"?


Thanks for the suggestion. Yes, I could do that, but I would still be left with the problem with the "As Of" date in the report header. Unfortunately, I need to copy an existing report which has this.

If I make the Textbox in the header as simple as possible:
=FormatDateTime(Parameters!hAsOfDate.Value, DateFormat.ShortDate)
I get the same error if no rows are returned, and so nothing in the report is displayed, just the message that says "The 'hAsOfDate' parameter is missing a value."
Go to Top of Page

bobzor
Starting Member

10 Posts

Posted - 2010-10-29 : 15:18:00
I turns out that just having the parameter refer to something in the dataset when no rows are returned is a problem, even when I don't use the parameter in the report at all.

So... I did use the NoRows property to display a message when there are no rows, and I had to go a different direction entirely for displaying a date in the report header -- it's now based on user input. Doesn't look quite the way it should, but at least the report doesn't blow chunks when no rows are returned. I love SSRS.
Go to Top of Page
   

- Advertisement -