Monday, July 9, 2012

Add Custom Code in SSRS

How to Add Custom Code in SSRS

1.       Create a new .rdl file open it
2.       Open the report and In the Design view, right-click the design surface outside the border of the report and click Report Properties.
3.       Click Code.
4.       In Custom code, type the code. Errors in the code produce warnings when the report runs. The following example creates a custom function named AddPrefix. (Code should be written in vb)
Public Function AddPrefix (ByVal s As String) As String 
Return “INV00” + s

End Function

5.       Use the below code to use this function in your report
=Code. AddPrefix(Fields!InvoiceCode.Value)

No comments: