Cover Image

Solution of devision by zero exception of RTC report layout expression. !

If you have an expression which result in devision by zero of RTC report layout, then result is #Error. You can write a VB function to avoid this issue. First you must write this following method in RTC report.
Open the report layout and got to the Code section of report properties, then you can write this following function in the Code section.


Public Shared Function DivideByValue(ByVal DivValue As Decimal, ByVal DivByValue As Decimal) As Decimal
If DivByValue = 0 Then
Return 0
End If
Return (DivValue / DivByValue)
End Function

After create the function you can call it in the expression as you need.
Following example for how to call this function in the report layout expression.


=Code.DivideByValue(Fields!TotAmt.Value,Fields!Quantity.Value)

Development Special