Databases Reference
In-Depth Information
Function
Description
Example
Tests an expression for a null
ISNOTHING()
=ISNOTHING(Fields!TheDate.Value)
value. May be nested within
=IIF(ISNOTHING(Fields!TheDate.Value),
an IIF() to convert nulls to
“n/a”, Fields!TheDate.Value)
another value.
Returns one of a list of values
CHOOSE()
=CHOOSE(Parameters!FontSize.Value,
based on a provided integer
“8pt”, “10pt”, “12pt”, “14pt”)
index value (1,2,3, etc.)
There are hundreds of Visual Basic functions that could be used in some form, so this list is just a start-
ing point. For additional assistance, view the online help index in Visual Studio, under Functions
[Visual Basic]. This information is also available on the public MSDN library at http://www.msdn
.Microsoft.com .
Using Custom Code
When you need to process more complex expressions, it may be difficult to build all of the logic into one
expression. In such cases, you can write your own function to handle different conditions and call it
from a property expression.
There are two different approaches for managing custom code. One is to write a block of code to define
functions that are embedded into the report definition. This technique is simple, but the code will be
available only to that report. The second technique is to write a custom class library compiled to an
external .NET assembly and reference this from any report on your report server. This approach has the
advantage of sharing a central repository of code, which makes updates to the code easier to manage.
The downside of this approach is that the configuration and initial deployment is a bit tedious.
Why Visual Basic?
Before the .NET (“Dot Net”) Framework was released in 2002, Microsoft offered two significant program-
ming languages with very different capabilities. The C++ language was for very serious programming
but required serious programming skills. The Visual Basic (VB) language has long been the flagship
extension to practically all Microsoft desktop products. VB programming emphasizes simplicity and
ease of use. Along with the framework, a new language, called C# (“C-sharp”) was created to use all of
the new .NET capabilities. The Visual Basic language underwent a major overhaul to bring it up to speed
with the framework. One of the goals of the .NET platform was to separate the capabilities of the frame-
work from the syntax of the languages. Since the inception of .NET, there has been a long-standing
debate over the relative strengths and weaknesses of these two languages. Although there have been
numerous articles and white papers comparing VB and C#, even industry experts have been reluctant to
make broad statements about one language being superior to another. An unspoken belief among sea-
soned professionals is that C# is the “more serious” programming language.
At the prelaunch event for SQL Server 7.0 in 1998, Steve Ballmer offered career advice to the many database
administrators in attendance. His advice was to learn Visual Basic programming. This seemed like a bold
statement to make to the system admin (rather than the developer) community. Years later, this advice
Search WWH ::




Custom Search