|Figure 5. Adding functions: You can create functions using the VB.NET syntax.|
Creating and Accessing Custom Code
To add your own code to a report, display the report properties page by right-clicking the gray section surrounding the report and click Properties. You can create functions using the VB.NET syntax.
To access your custom functions in an expression, use the syntax Code.Function. For example, to call the FormatDuration function above, use the code:
You can also reference your own assembly and use its properties and methods in your code, although this requires some manual modification of configuration files on your report server.
The Expression Editor is very basic. There is no code coloring, syntax checking, or IntelliSense. The tree view does not display the ReportItems and User collections, and does not list any custom functions you have added.
| Note: The syntax for calling code uses a "dot" character, not an exclamation point like you use for accessing report collections.
Deploying reports to a server from Visual Studio is very straightforwardjust right-click your report in the solution explorer and select the "Deploy" option. In my test environment, the first time I used this option, the operation took a long time (several minutes), but subsequent deployments were fairly fast, so be patient the first time. You can configure test and production server URLs in the project properties page and use the configuration typeReporting Services adds the "local debug" and "production" configuration types to the existing list that already includes "debug" and "release"to control which server reports are sent to.
Writing code to automate the deployment of reports to a server (as in a custom action for your setup program) is straightforward using the methods of the Reporting Services Web Service, and the Web service documentation is very thorough.
You can run reports by browsing to the Report Manager (http://yourserver/reports by default) and selecting your report. A pre-generated ASP selection page is displayed which you use to select options and render your report.
You can also create your own custom selection page, or render the report from a Windows Forms application using the Reporting Services Web Service.
The story behind the initial release of Reporting Services is that it was targeted for launch as part of SQL Server 2005, but the beta was so popular that Microsoft chose to release it early. This story rings true because Reporting Services is missing a number of key usability and productivity features that should really be present in a full release.
As a VB.NET developer, I like that fact that the expression language is VB.NET, but Microsoft should have included C# support, and should ideally support any .NET language. Being a server-side application, there are no client-side runtimes (or related problems) to worry aboutthis is a truly "zero footprint" application. I was surprised to see no code colouring or syntax checking in the expression editor. Hopefully, this feature will be added soon.
On the positive side, the fact that the developers "eat their own dog food" by using use their own Web service from the Visual Studio IDE means that as developers, we can do everything Microsoft can do with the reporting engine. It is very straightforward to develop code to deploy and render reports, and this area is well covered in the Reporting Services Books Online documentation.
I also like the developer focus of Reporting Services, although I won't be surprised if an end-user focused report designer is released at some stage in the future in order to round out the product.
I'm generally happy with Reporting Services, it is very much a useable and useful tool in it's current form, and I intend on continuing to use it. It's got flaws, but I believe my criticisms are very much "version one" issues. Other reporting tools I've used still have their problems despite having been around for years. .NET and SQL Server developers should go and get Reporting Services, and see if it helps to provide better reporting for your customers and users.