SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Handle Divide by Zero in SQL Reporting Services


Handle Divide by Zero in SQL Reporting Services

Author
Message
Clayton Groom
Clayton Groom
SSC Journeyman
SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)

Group: General Forum Members
Points: 96 Visits: 78
Comments posted to this topic are about the item Handle Divide by Zero in SQL Reporting Services

Kindest Regards,

Clayton
missmissalissa
missmissalissa
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 5
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
giosalma
giosalma
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 13
Thank you, Thank you, Thank you, Thank you, Thank you, Thank you.
pnelson 10021
pnelson 10021
Grasshopper
Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)

Group: General Forum Members
Points: 20 Visits: 95
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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search