Friday, February 24, 2012

Error Check tool

We have a report where we do a whole bunch of calculations.

Sometimes we get #div0 err,when you try to divide a number by 0, or NaN Error, when you are trying to divide 0 in the numerator.. Is there a tool, that can sopt check these errors on a report in reporting services, and generate a log that we can check daily for errs?Pl advise

I'm hoping this may help you:

http://blogs.msdn.com/bwelcker/archive/2006/09/26/End-of-Amnesia-_2800_Avoiding-Divide-By-Zero-Errors_2900_.aspx

|||I do have this IIF check on the textbox expression. Howe ver, I have abt 35 fields on the report, that has these calculations.. Its pretty timeconsumin to put this check on all the 35 fields. Hence I was lookin for a tool, that will capture such similar errors.|||This is the only tool I am aware of, not sure of its capabilities
http://www.ssw.com.au/ssw/SQLReportingServicesAuditor/

Maybe putting it in a code block would make it less time consuming|||

That tool appears to be the one I was looking for. However, I dont find any reviews on anybody using it and dont know of anyone who ahs used it. Would like to get some feedback on that before I can decide to use it.

When you say putting it in a code block, what exactly do you mean?

|||You can add code to a report as follows.

On the 'report' menu, select 'report properties' (if you can't see this, you may need to switch out of the 'preview' tab in the report designer.

From here you can see a 'code' tab.

You could add something like

NB substitute 'number' for whatever numeric datatype you are using, you might have to have multiple functions for this
one for int32, one for float etc

Function x(num1,num2) as number

If (num2 is nothing) or num2 = 0 then
return 0 'or whatever means something useful like 'n/a', but then you'd need to return a string Smile
else
return num1 / num2
end if

end function

Then in the expression, you can reference the code thus:
=Code.x(num1,num2)

At least it is less typing than an IIF

No comments:

Post a Comment