September 23, 2007 at 11:13 am
Comments posted to this topic are about the item Handle Divide by Zero in SQL Reporting Services
Kindest Regards,
Clayton
July 1, 2010 at 7:59 am
I'm new to SSRS and I'm having trouble understanding how to use this script. Can you please assist?
I've entered the following in the report perameters - code window.
Public Function CalcRatio(ByVal Numerator As Object, ByVal Denominator As object, ByVal DivZeroDefault As Object) As Object
If Denominator <> 0 Then
Return Numerator/Denominator
Else
Return DivZeroDefault
End If
End Function
I then entered the following in the expression of the textbox.
=code.CalcRatio((sum(Fields!total.Value)+(Fields!Adjustment.Value))/Fields!Goal.Value, 0)
but I get the following error.
The Value expression for the textbox ‘textbox28’ contains an error: [BC30455] Argument not specified for parameter 'DivZeroDefault' of 'Public Function CalcRatio(Numerator As Object, Denominator As Object, DivZeroDefault As Object) As Object'.
What am I doing wrong?
Thanks in advance for any help you may be able to provide.
Regards,
Missa
December 22, 2010 at 1:18 pm
Thank you, Thank you, Thank you, Thank you, Thank you, Thank you.
October 4, 2011 at 8:46 am
How can I apply the custom code to this following expression?
=((Sum(Fields!test1.Value) / Sum(Fields!test9.Value) * 10 + Sum(Fields!test2.Value) / Sum(Fields!test9.Value) * 10 + Sum(Fields!test3.Value) / Sum(Fields!test9.Value) * 10 + Sum(Fields!test4.Value) / Sum(Fields!test9.Value) * 10) – (Sum(Fields!test5.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test6.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test7.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test8.Value) / Sum(Fields!test10.Value) * 10)) / (Sum(Fields!test5.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test6.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test7.Value) / Sum(Fields!test10.Value) * 10 + Sum(Fields!test8.Value) / Sum(Fields!test10.Value) * 10)
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply