Neeraj...
I have tried something similar to this unsuccessfully. I've worked on this for some time and am at the point of throwing in the towel. I want to validate a parameter length. I've set up code a number of different ways and finally settled on the following:
Public Function CheckLength (ByVal MerchantID as String) As String
Dim msg As String
msg = ""
TRY
If MerchantID.Trim.Length > 4 THEN
msg="Merchant ID should not exceed 4 characters"
Else
msg = " "
End If
Catch ex As Exception
END TRY
Return msg
End Function
I then setup a parameter named "Validate" just as you described above. The parameter expression is set up as follows (I've tried many combinations):
=CODE.CheckLength(Parameters!MerchantID.Value)
I either get an error on the hidden parameter or it just does nothing (when hidden parameter set up as above).
Any advice would be greatly appreciated.
Ed