Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Handle Divide by Zero in SQL Reporting Services Expand / Collapse
Author
Message
Posted Sunday, September 23, 2007 11:13 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Yesterday @ 3:13 PM
Points: 67, Visits: 27
Comments posted to this topic are about the item Handle Divide by Zero in SQL Reporting Services


Kindest Regards,

Clayton Groom
covenanttechnologypartners.com
Post #401669
Posted Thursday, July 1, 2010 7:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 1, 2010 12:28 PM
Points: 1, 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
Post #946188
Posted Wednesday, December 22, 2010 1:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 26, 2014 9:15 AM
Points: 1, Visits: 8
Thank you, Thank you, Thank you, Thank you, Thank you, Thank you.
Post #1038464
Posted Tuesday, October 4, 2011 8:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 6, 2013 10:33 AM
Points: 2, 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)

Post #1185295
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse