Insert code in report

Hi! I want to use methods from Visual Basic into Reporting Service, for modify fields.
Fo example, I want to use a method for to round a number.
Thx!!
[166 byte] By [TypeON] at [2007-12-16]
# 1

VB function can be referenced from the report's code object. Here is an example:
If you want to use the Math.Round function, place code similar to this in report's code block :

shared function RoundNum( byVal Number as Decimal ) as Decimal
'round to one decimal place
return Math.Round( Number, 1 )
end function


Then, to reference it in the report, simply use an expression like this :

=Code.RoundNum(Fields!Current_Balance.Value)
Or, you could simply refer to Math.Round from within the report item's expression, thuswise:

=Math.Round( Fields!Current_Balance.Value, 5 )

Hope this helps.

doubleamericano at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...

SQL Server

Site Classified