Alex
Alex

Reputation: 2111

ReportViewer question

I have a column that divides a field by another field. And if it is 0 I it prints Error. How can I get it to print nothing or a 0 in this situation?

Upvotes: 0

Views: 236

Answers (2)

MMalke
MMalke

Reputation: 2106

You should try this one:

=IIF(Fields!F1.Value <> 0, Fields!F2.Value / 
   IIF(Fields!F1.Value <> 0, Fields!F1.Value, 42), 0)

Also check this link for more information.

Upvotes: 0

Stefan Mohr
Stefan Mohr

Reputation: 2170

Can you just create an expression for the result column and display the result conditionally?

Eg, instead of:

=ColumnA!Value/ColumnB!Value

Use something like:

=Iff(ColumnB!Value <> 0, ColumnA!Value/ColumnB!Value, 0)

Upvotes: 1

Related Questions