Hi,
I am designing a report using SRS 2000. I want to validate parameters before executing the query. Suppose if user gives a random number for parameter (say Emp ID), i want to display a error message in a textbox "There are no records for the given employee ID" and stop executing query to display employee details in the table.
I tried using Visible expression for table IIF(Fields!EmpID = "", False, True). But when I run the report with a random number, an error populated saying "You cannot query a record for no data..."
Please suggest me a work around.
Regards,
One workaround may be to use a stored procedure and perform validation within it. Return a result set that provides either a data result or error values within your dataset. Use visibility expressions on the reporting services to show-hide either the table that returns the data or the table that returns the error message.
eg.
if @.myparam = 'bad'
select 'bad' as column1
else
select column1 from mytable
then you do a check for the first value of column1. If it's bad show the error table, otherwise show the regular table.
cheers,
Andrew
|||Hi Chiro,
Here's how it works.
In your table properties, locate the NoRows properties of the table. Place your message.
Note: If you use this you cannot change the font color because reporting services does have a color property for this.
or
Try this
Add a Rectangle into the body of your report
In the Visibility property of the Rectangle, locate the Hidden and click expression.
Place this in your Rectangle
=iif( Sum(Fields!EmpID.Value, "Your Dataset")>0, False, True)
Then try running the report.
|||Thanks for the reply. I managed it by using 2 datasets, 1 for validation parameters and 1 for getting data. I dont know why the above method which u have suggested is throwing error "You cannot fetch records for no rows or some thing..." when i try entering some junk characters like "23423daedfsrewAFSD".
Any way. Thanks for the reply.
Regards
No comments:
Post a Comment