Using custom Assemblies with SQL Server Reporting Services.

In almost every Reporting Services class I teach, I get basically same questions. One of the most popular questions is how do I call a method in a custom assembly from my report.  Here are step By step, instructions to do this.

 

1.       Using Visual Studio Create a new Class Library(VB or C#) I am going to name my Project SSRSAssembly

2.       Rename your Class1.VB or Class1.CS to ComplexCalculations, presumably you would have your re-usable methods in this class

3.       For next step, please use your imagination, pretend the following function has a few lines of code with loops possible calls to other assemblies and does some complex calculations (instead of just returning the square value of the parameter being sent to it.

(a)    Add the following Method to your Class

VB

Public Function SquareMe(ByVal i As Integer) As Integer

        Return i ^ 2

End Function

C#

public int SquareMe(int i)

{

    return Math.Pow(i, 2);

}

    

4.       Build Your project .

5.       Open your Report project.

(1)    Access your report properties from the Reports menu option

(2)    Click on the reference tab and add a reference to your assembly by browsing to it.

(3)    Define the class name ( in my example I called my class  ComplexCalculations)

(4)    Provide an Instance name.

6.       In a textbox within your dataregion where you want to display the result of your call, enter:

=Code.MyInstance.SquareMe(Fields!SickLeaveHours.Value)

7.       Copy your Custom dll to Report Server bin folder (default location is C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin)

8.       Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin.

9.       After the last <CodeGroup .. add

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="SSRSAssembly" Description="reportHelperLib. ">

                <IMembershipCondition

                class="UrlMembershipCondition"

                version="1"

                Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\SSRSAssembly.dll"

/>

              </CodeGroup>

10.   Note you might have to change the Name and the URL.

Comments

# re: Using custom Assemblies with SQL Server Reporting Services.
Gravatar Physical force or threats may make children do as wow goldthey're told in the short term but their compliance will last only as long as the threat is relevant. wow goldThen they will go back to doing what they wanted to do in the first place.
Left by hobg on 11/19/2008 7:11 AM
# re: Using custom Assemblies with SQL Server Reporting Services.
Gravatar In truth, the economy is slowing more markedly than these (highly suspect) official figures suggest. wow goldMany economists say that China has an institutionalised bias to over-reporting growth at the bottom of a cycle and under-reporting it at the top, to reduce the volatility of the numbers.
Left by mei on 11/19/2008 7:12 AM
# world of warcraft gold
Gravatar government researchers said Wednesday.
Left by bgg on 2/5/2009 10:10 PM
# wow gold
Gravatar “Cavalli” was chosen as the favorite menswear label in Florence in 2002,wow gold and Cavalli was picked
Left by zhuqian on 2/10/2009 6:37 AM
# re: Using custom Assemblies with SQL Server Reporting Services.
Gravatar I think this article was a great. easy to follow.
Left by dll on 3/14/2009 10:31 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Preview Your Comment.