Parameter validation
Is it possible to create a server side or client side validation for parameter inputs? For example, I want a calender input to error when a user tries to put in a date past the current date time
October 17th, 2006 5:10am
Yes!
You need to adda function to validate the parameters.
Go to the Report Properties under the Report menu and place this code to the Code Tab.
Function CheckSignificantDate(StartDate as Date, EndDate as Date) as IntegerDim msg as String msg = "" If (StartDate > EndDate) Thenmsg="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 IfEnd Function
Then go to the Report Parameters and Add named it Validate with the datatype is string. Checked the Hidden and Allow blank value ckeckboxes. In Available Valueschoose Non-Queried and from Default Valueschoose Non-Queried inright side of textbox then pressthe FX buttonthen paste this code.
=CODE.CheckSignificantDate(<parameterStartdate>.Value,<parameterEnddate>.Value)
Then press OK.
Free Windows Admin Tool Kit Click here and download it now
October 17th, 2006 5:49am
This is great, is there anyway to integrate this with making a error message visible on the reportand not through a popup message box?
Thanks for the solution.
October 17th, 2006 6:35am
Hi Gil,
Its working,It is displaying the message box but Report generation is not stopped.Report is generating but displayingno data.What i have to do is display the message box containing startdate should not be later than enddate,and user enter tha dates again, stop the report rendering
How to handle this
Please help me.
Thanks in advance
Free Windows Admin Tool Kit Click here and download it now
October 17th, 2006 7:06pm
Hi mahimam,
I think you forgot to do this.
Go to the Report Parameters and Add named it Validate with the datatype is string. Checked the Hidden and Allow blank value ckeckboxes. In Available Valueschoose Non-Queried and from Default Valueschoose Non-Queried inright side of textbox then pressthe FX buttonthen paste this code.
=CODE.CheckSignificantDate(<parameterStartdate>.Value,<parameterEnddate>.Value)
Report generation should stop because you already set the parameters to the report properties once you click the view report button.
October 18th, 2006 11:36am
Yes!
All you have to do is delete the Validate Parameter that you add from the Report Parameter and the Codes that you paste from the Report Properties.
Then into your form. drag a Rectangle from the toolbox. Set the Border Color to red (this is the standard for an error message, in case you are not familiar) =D. Just kidding.Drag a texbox into your rectangle place the message "Date From should not be later than Date To.". Into the Rectangle properties, go to the Hidden properties under the Visibility propertyof the rectangle then add this expression:
=IIF(Parameters!StartDate.Value > Parameters!EndDate.Value,false,true)
You can now test your report.
Note: Applies only in the Body of the report.
Free Windows Admin Tool Kit Click here and download it now
October 18th, 2006 12:05pm
Hi,
I did like that,but popup i displaying but in the report server iam getting error,error in processing 'Validate' parameter.
Thanks in advance
October 19th, 2006 5:32pm
Hi, even I am facing same problem, where I am also getting same error called "error in processing 'Validate' parameter."did you got any solution.If yes please share the solution with me.thanks,Ramesh KS
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2007 12:31pm
Hi,
I think the error is displaying because of the line "Err.Raise()", If we remove this line It is working fine.But if we remove that there is no meaning.
Thanks
January 15th, 2007 4:02pm
try copying theCODE to theNon-Queried function inthe Default values: (below the Available values:)
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2007 6:21pm
Hi, I am using the function called "CheckSignificantDate" which is mentioned below.This is my current situationreport can works in the report designer (in preview),but it doesn't work on the server after i deployed it to the server.deploy successfully,why does it give me the message that is Error during processing of 'fromYear' report parameter.(rsReportParameterProcessingError).do I need to do anything with custom assemblies?or any other reasons this?Regards,Ramesh KSfunction which I used:Function CheckSignificantDate(ByVal StartDate As Date, ByVal 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") Return 0 End If Return 0 End Function
January 17th, 2007 10:26am
Please try using the below solution it helped me to solve similar issue.
1) Add a TextBox to the Report.
2) In the Value Field for the TextBox add the below value=IIF(Parameters!FromDateTime.Value>Parameters!ToDateTime.Value Or Parameters!ToDateTime.Value < Parameters!FromDateTime.Value,"Invalid Date Parameters Supplied, Please Check the Date Parameter Values","No Data is Available for the Selected Date Range between " & Parameters!FromDateTime.Value & " and " & Parameters!ToDateTime.Value & ".")
3) In its Visibility Property Hidden value add the below Code.=IIF(CountRows("CCFReportDS")>0,True,False)
Free Windows Admin Tool Kit Click here and download it now
November 7th, 2007 10:05am
Problem with these all above solution is
It first show Error Message and then got to database.
Is there any solution that can beonly client side validation instead of database round trip?
January 30th, 2008 10:53am
Hi,
It sounds like a custom ASP.NET page might be a better solution. You would have complete flexibility to provide validation messages to the user and could render the report by calling the Render() method of the ReportServiceExecution2005 class.
Hope this helps,
Bill
Free Windows Admin Tool Kit Click here and download it now
February 7th, 2008 7:51pm
Hi there,
I did the same and i am also getting the error '
Error during processing of Validate report parameter. (rsReportParameterProcessingError) ' and not like the pop up as it was working before deploying and giving an error message with specified error.
Did anyone ever happen to get the solution for this?
Thanks!
July 22nd, 2008 6:25pm
Looks like this thread is on the right track.
Let me make several comments:
1) add a textbox to the report that is visible only if validation fails. This text box you can use to display an error message to the user.
2) put the rest of your report in a rectagle and set it to be hidden if there is a parameter validation error. This way SSRS will not run entire report.
3) using Err.Raise() or popping up error dialogs is only a partial solution and infact could stop working in future versions. Key problem is that these reports will not work with subscriptions/scheduled executions. Recommend the text box approach.
Hope that helps,
-Lukasz
This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2009 9:20pm
Lukasz,Please let me know what is the solution for a similar problem i am having..Problem description:
I am using the function to embedd within the report .This function is called the user presses the view reportbutton.It worksin the report designer (in preview),but it doesn't work on the server after i deployed it to the server.deploy successfully,why does it give me the message that is Error during processing of '@ParameterName' report parameter.(rsReportParameterProcessingError).do I need to do anything with custom assemblies?or any other reasons this?
Regards,Kay
May 7th, 2009 5:05pm
Hi KiranNJ, Have you found any solution finally? I am facing the same problem.. thanks, Zen
Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2009 12:07am
Take a look at your report server trace log files - ti should provide a detailed error message. There can be problems such as:1) your code makes calls restricted by CAS policies - then you need to change the CAS settings in the report server policy file to ensure it works.2) you have a bug in your code where you assume something which is not true on the server. If you're using a custom assembly, you should be able to attach a debugger to the report server process and put a break point on your custom assembly.3) you could simply have a bug ( but I'dstart with looking at #1 :).Hope that helps,-LukaszGot a bug or feature request? Tell me about it at http://connect.microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
September 3rd, 2009 6:23pm
Hi Lukasz Im facing the same problem i odnt think its a bug in the code since the code is working really nice on the development machine , for me this error appear when the reports got deployed to the server .Malik Al-Shayeb
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2009 3:48pm
Take a look at the this link.. started by me for a similar issue..You will find the possible solution for your problem..http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/11a7c6de-6754-4d12-b469-a3b494d1b216
Let me know if it worked...
September 14th, 2009 10:14pm
Hello,I'm facing the same problem. Could you tell me if you get any solution of that?Regards,Juancho.
Free Windows Admin Tool Kit Click here and download it now
January 6th, 2010 11:20pm
I tried to add a textbox and put the rest of the report into a rectangle.The report works fine except the rectangle cuts my matrix data in the report viewerand it looks very strange to users.What should I do to solve this problem?Thanks.SQL Server 2005 SP3, SSRS 2005, Windows 2003
January 19th, 2010 5:17am
This is just a work around.
I have a similar issue.I have to run the report having Muiltivalued Parameters.I had to restrict the number of values selected to 5 only.
I have created a textbox with Error msg. And given the expression based on Selected parameters count on this textbox.And a similar expression in my Tablix.
It does work but if a user selects say 7 users,then The report will be execute for these 7 users(which is time consuming) and then the Error msg gets visble:"You can only select 5 values at a time". This seems approporiate.
Is there a way to stop the report execution in case the count >5.
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2011 1:40am