wafw1971
wafw1971

Reputation: 361

Difference in iif statements

A hope someone can help:

What is the difference between this

=iif(Parameters!WhichReport.Value(0) = "Occupancy", False, True)

and this

=iif(Parameters!WhichReport.Value = "Occupancy", False, True)

Ta

Wayne

Upvotes: 1

Views: 100

Answers (2)

Mathew Thompson
Mathew Thompson

Reputation: 56429

The first works on the notion that the parameter passed in is an array of values. So Value(0) will retrieve the first item in the array, whereas the second statement works on the notion that there is only one item with that parameter named passed in.

As arrays are indexed based on a start of 0, Value(0) will return you the first item in the value array, whereas Value(1) would return the 2nd, and so on...

Upvotes: 1

Lamak
Lamak

Reputation: 70638

This isn't T-SQL at all, if anything, this looks like an expression from SSRS, am I right?. If so, the difference between Parameters!WhichReport.Value and Parameters!WhichReport.Value(0) is that the first one is for single valued parameters (thus, it is the only value that can store), and the second expression is for multi valued parameters (in this case, the first value selected since is Value(0)).

Upvotes: 2

Related Questions