Sreekanth,
I noticed that you're testing if AMOUNT_VARIANCE_CENTRICA is zero, but that may still cause "Division by zero". To be 100% sure I recommend that you test LCH_AMOUNT on zero, because that's the denominator...
See snippet, that function will return the result of the division, or zero if LCH_AMOUNT is zero. It also divides by 100 for the percentage.
You just need to use it like in your initial mail:
=Code.VarAmountVariance(Fields!AMOUNT_VARIANCE_CENTRICA.Value,Fields!LCH_AMOUNT.Value)
For the formatting, I recommend to use the Format property of the textbox in which you are putting this expression. You can use something like the following for a percentage with 2 decimal positions: #,0.00 %
Hope this helps you out?
Valentino.
1:
2:
3:
4:
5:
6:
7:
|
Public Shared Function VarAmountVariance(ByVal AMOUNT_VARIANCE_CENTRICA As Decimal, ByVal LCH_AMOUNT As Decimal) As Decimal
If LCH_AMOUNT = 0 Then
Return 0
End If
Return AMOUNT_VARIANCE_CENTRICA / LCH_AMOUNT / 100
End Function
|