x

Cell displays #Error when I require an int SSRS

Hi,

I'm having a problem when trying to display a 0 when there is an occurrence of a special which I have listed in my data source

The normal sum computes fine and displays in the cells without the special day, but the cells which have a special day displays an #error

=iif(Fields!SpecialDay,
0,
Fields!NormalSum)
and then I have tried variations to get the integer, such as

CInt("0") Fields!NormalSum - Fields!NormalSum

but I still get an #Error in the cells for which I wish to display a 0.

Any thoughts on this particular problem?

Many thanks

more ▼

asked Jan 11, 2011 at 01:34 AM in Default

avatar image

node18
75 6 6 9

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

IIRC Iif is an if-then-else sort of operation, so you need to return a true/false for Fields!SpecialDay. Have you tried doing a comparison against a certain value?

e.g =iif(Fields!SpecialDay = 1, 0, Fields!NormalSum)

This equates to: "If Fields!SpecialDay equals 1 then return 0 otherwise return Fields!NormalSum"

It may be that SSRS is not seeing SpecialDay as a true/false value in the statement you supplied (i don't know if it is clever enough to do that like "real" programming languages can - i may be wrong though).

more ▼

answered Jan 11, 2011 at 01:44 AM

avatar image

WilliamD
26.2k 18 35 48

Thanks, I opted to use the nothing keyword =iif(Fields!SpecialDay = Nothing, Fields!NormalSum, 0) Because we can't use the NULL in SSS

Jan 11, 2011 at 02:10 AM node18
(comments are locked)
10|1200 characters needed characters left

Try =iif(Fields!SpecialDay,"0",Fields!NormalSum)

more ▼

answered Jan 11, 2011 at 01:44 AM

avatar image

Cyborg
10.8k 37 55 51

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x679

asked: Jan 11, 2011 at 01:34 AM

Seen: 1404 times

Last Updated: Jan 11, 2011 at 01:34 AM

Copyright 2016 Redgate Software. Privacy Policy