SSRS Adding Code and also custom assemblies to reports
28-Jan-1212 Leave a comment
How to add Code to SSRS reports
- Right click on report > Code > Type code as Visual Basic function
- In expressions within a data region use Code.<functionname> e.g. =Code.OrdinalFunction(4)
Code for Ordinal Number readily avialable on web. Example use in SRS.ReportingServices.Functions and also in my invoice report
How to add custom assemblies to SSRS reports
- Create a class library project in Visual Studio VB.Net or C#
- Use a meaningful assembly name e.g. <initials>.ReportingServices.Functions
- Add a class and methods to this class. Make the methods shared
- Compile to create a dll
- Copy the dll to the equivalent location of:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies
You may not need the (x86) and you may be on a lower or higher version than 9.0 - In VS BIDS report right click > report properties > References > Add the reference
- In expressions in a report use full Namespace.ClassName.FunctionName(variables)
Next deploying the assembly to the report server
- Copy your DLL to the following location or equivalent:
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin
Good luck. Acknowledgments to: