Reporting - IIF inside Sum gives unexpected #error in expression

Yes ! Was really confused with this error when saw it, missing details of the errors made me crazy
after 1 hour I got an idea.
so how it looked for the first time

=Sum(IIf(Fields!ContractID.Value <> 0, Fields!hours.Value,0))

I was 100% sure that it should work , but it did not !!!!
the reason is in Fields!hours.Value, it returns STRING which cannot participate in Sum expression
yes, now it's clear. So expression should look like

=Sum(IIf(Fields!ContractID.Value <> 0,CDbl(Fields!hours.Value),0.0))


hope this will save your time !!!

Comments

Popular posts from this blog

How to poll database using WCF-SQL adapter

SQL query timeout from application but works fast from SSMS