In a previous post I wrote about how you can use embedded custom code to extend the capabilities of Reporting Services. This week I will show you another method of using custom code but this time with external assemblies. Ideally when using custom code you would choose to do so using external assemblies. External assemblies help developers manage code from outside Reporting Services and share the exact same code across multiple report. Here’s a few of the pros and cons of using external assemblies for custom code.
In this example I’m going to walk you through beginning to end of an example of how to create an external assembly then use it in Reporting Services. Our goal is to compartmentalize our code into and assembly so every developer does an age calculation the same way. Calculating age can easily be done in the expression language the Reporting Services provides but using the assembly assures It’s done the exact same way every time. These steps will walk you through:
Public Class Age
Public Shared Function CalculateAge(ByVal BirthDate As Date) As Integer
Return DateDiff("yyyy", BirthDate, DateTime.Now())
I hoped this step by step helps. If this topic is something that interest you then you may also be interested in a SSRS Master (Advanced) Class I’m teaching. You can find when the next one is here.