Add custom code to a report to make it available for use in expressions.
To add code
- On the Code tab of the report, enter your custom code in the provided text box using instance based Visual Basic .NET. For example:
Function CalcDiscount (x As Double, y As Double, z As Double) As Double Dim disc As Double disc = (x * y * z) Return disc End Function
- On the Layout tab of the report, use your custom code in report item expressions with syntax like the following.
=Code.CalcDiscount(Fields!Quantity.Value, Fields!Price.Value, Fields!Discount.Value)