Enhance Reporting Services By Including A Function Library
First we write a .Net function library called:
- DirtyThings.Dll.
It contains "Public Class BodilyFunctions ...", and:
'BodilyFunctions' includes a Function called "Pick_Your_Nose_And_Eat_It"
Now let's get our Reporting Services Report to use the 'Pick_Your_Nose_And_Eat_It' function!
Copy DirtyThings.Dll into the Report Designer folder on our machine. This ensures that "Preview" will work while you are developing the report.
(The default location of the Report Designer is C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer)
Copy
DirtyThings.Dll
onto the Server.It goes in the Report Directory Server, the default location of which is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin.
Tell your Report to use the DirtyThings.Dll.
How do we do this?
In your Reporting Services Report:
- Go to the Report Properties dialog (Report Menu | Report Properties, or right-click the background of the report layout and choose 'Properties')
In the References tab: Click the ellipsis buttons next to the 'References' listbox(i.e., the button with three dots on it)
Use 'Browse' to find the 'DirtyThings.Dll' file. Click OK.
In the "Classes" list box, type "DirtyThings.BodilyFunctions" in the Class Name column. ('DirtyThings' is the namespace of our class, and bodily functions is the class we want to instantiate.)
Put "oBodilyFunctions" in the "Instance Name" column, this is the object we'll be using in our expressions.
Click OK and close the Report Properties dialog
Now we can access our functions from any expression in the report, by typing:
=Code.oBodilyFunctions.Pick_Your_Nose_And_Eat_It()
(Or in a more general sense: '
Code.{instance Name}.{function name}
' )
Oh yeh, those boring losers at msdn have also written up how it's done, in their article Deploying a Custom Assembly
Next → ← PreviousMy book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.