The problem is this: The IIF function evaluates all of its arguments. So
CInt(Parameters!BatchNumber.Value) gets evaluated even if BatchNumber is
"All".
=iif
(
IsNumeric( Parameters!BatchNumber.Value ),
CInt (iif (IsNumeric (Parameters!BatchNumber.Value),
Parameters!BatchNumber.Value, 0)) = CInt(Fields!BatchNumber.Value),
True
)
By the way, why not to compare strings instead of numbers?
=iif
(
IsNumeric( Parameters!BatchNumber.Value ),
CStr(Parameters!BatchNumber.Value) = CStr(Fields!BatchNumber.Value),
True
)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
[quoted text, click to view] "Ibexx" <Ibexx@discussions.microsoft.com> wrote in message
news:A2C5E040-D33D-4C84-9FC7-08EDEC6FBB12@microsoft.com...
>I have created a report param of type string named BatchNumber. The
>default value is "All". However if the user wants to filter for a
>particular batch number they might change this param value to "1" or "2",
>etc.
> This is my data filter:
>
> Expression:
> =iif
> (
> IsNumeric( Parameters!BatchNumber.Value ),
> CInt(Parameters!BatchNumber.Value) = CInt(Fields!BatchNumber.Value),
> True
> )
>
> Operator:
> =
>
> Value:
> =True
>
> When I run the report I get the following error only if ran with default
> value of "All":
> Fail to evaluate FilterExpression/FilterValues.