Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS hide #Error displayed in cell

I am doing computations on that data that will result in #Error at times. The underlying cause is a divide by zero. I could jump through the necessary work arounds to avoid the divide by zero, but it might be simplier to mask the #Error text and show a blank cell. Is it possible to hide the #Error and just display nothing?

Edit

The expression for the text might display #Error is something along these lines:

Fields!Field1.Value / Fields!ValueThatMightBeZero.Value

I could work around this with some ugly checking, but it might be easier to just catch the #Error. (A straight iif check around the express doesn't work because SSRS evaluates both the true and false clauses first; if it gets a divide by zero on either clause, it will return #Error, even if that clause wouldn't have been used).

like image 967
poke Avatar asked Feb 04 '12 20:02

poke


People also ask

How do I hide data in SSRS report?

To hide static columns in a table, matrix, or list. In Design view, select the table, matrix, or list to display the row and column handles. Right-click the column handle, and then click Column Visibility. In the Column Visibility dialog box, follow steps 3 and 4 in the first procedure.

How do I hide a text box in SSRS?

Click on the expression button fx . Enter the expression =IIf(CountRows("Items") = 0 , True, False) . Note that this expression is to hide the Textbox (Hidden). Click OK twice to close the dialogs.

How do I restrict access to SSRS reports?

Denying Access to My Reports You can prevent users from accessing My Reports by: Disabling My Reports on the Site Settings page. For more information, see Enable and Disable My Reports.


2 Answers

Change the font to be the color of the background if Fields!Value_Denominator.Value=0 and you won't see the error message.

like image 196
Gil Avatar answered Sep 29 '22 06:09

Gil


There is an IsError function, but it won't reduce the code you need to handle this. If you don't like the usual iif work arounds, then I think you need to use your own embedded code in the report. In that code you can have a try catch handler. Create a function that you can call with =Code.MyDivider(Fields!Field1.Value , Fields!ValueThatMightBeZero.Value)

Public Function MyDivider(top As Double, bottom As Double) As Double
    If top = 0 Then Return 0
    If bottom = 0 Then Return 0
    Return top / bottom
End Function
like image 21
Jamie F Avatar answered Sep 29 '22 08:09

Jamie F