The reason you are getting #Error is because everything single part of the
expression gets evaluated so your sum gets evaluated. You can't detect the
#Error because this is happening due to an error. You you need to do pass
the field to your GetSumResult and have it do the calculation so that you
don't do any invalid arithmetic.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
[quoted text, click to view] "Sam" <Sam@discussions.microsoft.com> wrote in message
news:64FAF868-C0D2-4888-9B8A-091FE98868F7@microsoft.com...
> I have some report fields with complex expressions. The expression
includes
> functions like abs(), sum() as well arithmetic operations.
> Example:
> =Code.GetSumResult(
> iif(Fields!Measures_A.Value.ToString().IndexOf("Percentage") > 0,
> Fields!Measures_Xyz.Value,
iif(Fields!Measures_A.Value.ToString().ToUpper() =
> "ABC" or Fields!Measures_A.ToString().ToUpper() =
> "EFG",ABS(Convert.ToInt32(Fields!Measures_B.Value)),
> sum(Fields!Measures_C.Value))/1000))
>
> Now Code.GetSumResult( ) function converts any of the value "NaN" or
> "Infinity" or "-Infinity" value to 0 (Zero). I am unable to convert
"#Error"
> to zero. How can I detect the input value is "#Error". I tried InputVal =
""
> or IsDBNull(InputVal) or IsError(InputVal) or InputVal Is Nothing etc..but
> unable to detect "#Error" value.
>
> Please let me know anyone knows how to resolve it.
> Thanks,
> Sam