Numeric Field Validation in SSRS Parameter Part-2

In my previous article you have seen how to validate date parameter.Click Here For my Previous Article Now in this article we will see how to validate numeric parameter value.

Let’s start.
Step 1: we need to write VB code to validate value is numeric or not.
I write below  VB code to validate Numeric value.
 Function IsInputNumeric(Number1 As String,Number2 As String) As String
Dim RetValue As String
 If (IsNumeric(Number1) and IsNumeric(Number2)) Then
RetValue="Valid"
Else
RetValue="Please Enter Valid Order ID!!"
End If
Return RetValue
    End Function

Function Description: I have written IsInputNumeric functions which accept two parameters which are number1 and nember2. Then I have use IsNumeric in-built function of VB to validate each number parameter and return message accordingly.
Note: In above function I have used two parameters for validation you can use any number of parameter according to requirement.


Step 2: After that we need to create one parameter IsValidNumber which datatype should be Text and visibility of parameter should be Internal.
After that go to default values tab and specify value and then call this function over here.

Step 3: After above step we need to validate both parameters before passing it to dataset.
Click on above marked button and write below expression in expression window.

Step 4: Now we need to add textbox in SSRS report design and then go to textbox properties window and call IsvalidNumber parameter in value expression of textbox and then set visibility of textbox.

Step 5: Then Preview SSRS report and test above logic which is running or not. Here I put string in both textbox but my query accept only numeric value so this message for our user 

In Next Article i will discuss about- Validate Parameter against value range. Like only 0-10 digit/Character accepted by Parameter.
Thanks For Reading.

Author

Priti Kumari

I am technical blogger.I blogs at www.c-Sharpcorner.com and https://aspdotnetmyblog.blogspot.in/.

No comments:

Post a Comment