Reputation: 19
I'm trying to write an IFF statement in SSRS report inside Visual Studio.
For this scenario, In my data I have the following two fields, MaxCompareDateLapse and MaxCompareDateLapse2. Both of these return integer values. I also have a parameter which has the following values available for the use to select: 3, 6, 9, 12
I'm entering an IFF statement in an expression and I'm getting back the error 'The Value Expression for the textrun 'MaxCompareDateLapse.Paragraphs[0]' contains an error: [BC30451] 'IFF' is not declared. It may be inaccessible due to it's protection level'
I've tried the following two expressions and they both give me back the same error. The first one below is ultimately what I want to get it, and the second one I simplified a bit to see if it would work but I still get the error.
Code #1
=IFF(Fields!MaxCompareDateLapse.Value <
Parameters!pMonthsNoActivity.Value, Fields!MaxCompareDateLapse2.Value,
IFF(Fields!MaxCompareDateLapse.Value >=
Parameters!pMonthsNoActivity.Value, Fields!MaxCompareDateLapse.Value))
Code #2
=IFF(Fields!MaxCompareDateLapse.Value <
Parameters!pMonthsNoActivity.Value,
Fields!MaxCompareDateLapse2.Value,
Fields!MaxCompareDateLapse.Value)
So for example 1. If MaxCompareDateLapse =1, Parameter = 6, and MaxCompareDateLapse = 20, then 20 would be returned. If MaxCompareDateLapse = 7, Parameter = 6, and MaxCompareDateLapse = 5, then 7 would be returned
Thanks in advance - still pretty new to this stuff
Upvotes: 1
Views: 5367
Reputation: 9664
You should replace the IFF with IIF as that is the correct syntax.
Refer to foll. example:
=IIF( Expression to evaluate,
what-to-do when the expression is true,
what-to-do when the expression is false )
You can nest using the 2nd and/or 3rd arguments based on your requirements. Example if you want to nest another IIF check if the above expression is false:
=IIF( 1st Expression to evaluate,
what-to-do when the 1st expression is true,
IIF( Another Expression (2nd) to evaluate,what-to-do when that 2nd expression is true,what-to-do when that 2nd expression is false )
)
Hope this helps.
Upvotes: 1