Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Date report parameter validation issue Expand / Collapse
Posted Friday, September 27, 2013 1:05 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 11, 2013 10:19 PM
Points: 25, Visits: 23

I am trying to validate report paraters which are calendar dates. I am checking the logic for end date should not be less than start date. My code snippet is as follows:

Function CheckSignificantDate(StartDate as Date, EndDate as Date) as Integer
Dim msg as String
msg = ""
If (StartDate > EndDate) Then
msg="Start Date should not be later than End Date"
End If
If msg <> "" Then
MsgBox(msg, 16, "Report Validation")
Err.Raise(6,Report) 'Raise an overflow
End If
End Function

First time when you run the report, it works. But if I run the report second time, it does not give error and report start processing.
Can we add validation somewhere in report that will validate the parameter for every run?
Post #1499218
Posted Monday, October 7, 2013 5:34 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 6:12 PM
Points: 827, Visits: 342
SSRS as such doesn't allow validations of parameters. But you may handle this using expressions to some extent. If your parameter meets certain criteria, then only assign dataset or set visibility to true, and so on.

Another way would be creating a custom page (may be .aspx) and call report within that. Not sure, it covers under your application scope.
Post #1502424
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse