all groups > sql server reporting services > august 2005 >
You're in the

sql server reporting services

group:

whats wrong with this code??



whats wrong with this code?? SLB
8/5/2005 3:31:02 PM
sql server reporting services: =sum(iif(Fields!PDDAYS.Value>30, Fields!CBAL.Value),0)

It returns #ERROR

Isdbnull did not seem to work and the LEN thing did not seem to do it, but
Re: whats wrong with this code?? Jaime Stuardo
8/5/2005 9:15:52 PM
You have placed parenthesis in the wrong order. I think it should be:

=sum(iif(Fields!PDDAYS.Value>30, Fields!CBAL.Value,0) )


[quoted text, click to view]

Re: whats wrong with this code?? SLB
8/8/2005 8:16:05 AM
No that did not work, but I have been finding problems with this and I think
the answer is to create the column in the query and then sum that up..Seems a
little flakey.

[quoted text, click to view]
Re: whats wrong with this code?? C.M
8/9/2005 9:18:01 AM
sum(iif(Fields!PDDAYS.Value>30, Fields!CBAL.Value,0) ) does not look right to
me .
I guess it depends on where this formula is in the grouping but try this

iif(Sum(Fields!PDDAYS.Value)>30, sum(Fields!CBAL.Value),0) )

or
iif(Fields!PDDAYS.Value>30, sum(Fields!CBAL.Value),0)


[quoted text, click to view]
RE: whats wrong with this code?? Brian P
9/16/2005 12:21:05 PM
SLB,

I agree about this not working correctly. I have a similar formula in a
group where I would like to reference two other summed fields in the same
group (like this):

=IIf(sum(Fields!curr_schd_amount.Value) = 0, 0,
(sum(Fields!curr_recg_amount.Value) / sum(Fields!curr_schd_amount.Value)) *
100)

I get #error as well. It is almost as if the code not honoring the If check
and processing the division anyway.

[quoted text, click to view]
Re: whats wrong with this code?? Brian P
9/16/2005 1:24:02 PM
Bruce,

Thank you. I will give this a try.

Brian

[quoted text, click to view]
Re: whats wrong with this code?? Bruce L-C [MVP]
9/16/2005 3:14:49 PM
IIF evaluates both values. So it cann't be used to prevent divide by zero
for example.

you could use code behind to do this. pass in the value and use if then else
to do your calculation and return the appropriate value.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button