Jonathan Mooney's office recently lost their resident SQL Server Reporting Services guru to greener pastures. As such, a general consensus began to take hold of the teams that nobody could ever hope to match his high-level abilities and that their organization as a whole was doomed.
This fear was confirmed after the first programming change arrived after the guru's departure. A relatively simple one really - allow for the addition of another parameter - "Overview". Unfortunately, the departed guru prided him self on his complex methods, as represented by the code below.
=SWITCH(
Parameters!View.Count = 1,IIF(Parameters!View.Value(iif(Parameters!View.Count=1,0,0)) = "Redemptions" ,false,true),
Parameters!View.Count = 2,IIF(Parameters!View.Value(iif(Parameters!View.Count=2,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=2,0,0)) = "Redemptions",false,true), Parameters!View.Count = 3,
IIF(Parameters!View.Value(iif(Parameters!View.Count=3,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=3,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=3,0,0)) = "Redemptions",false,true), Parameters!View.Count = 4,
IIF(Parameters!View.Value(iif(Parameters!View.Count=4,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,0,0)) = "Redemptions",false,true), Parameters!View.Count = 5,
IIF(Parameters!View.Value(iif(Parameters!View.Count=5,4,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=5,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=5,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=5,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=5,0,0)) = "Redemptions",false,true), Parameters!View.Count = 6,
IIF(Parameters!View.Value(iif(Parameters!View.Count=6,5,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=6,4,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=6,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=6,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=6,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=6,0,0)) = "Redemptions",false,true), Parameters!View.Count = 7,
IIF(Parameters!View.Value(iif(Parameters!View.Count=7,6,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,5,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,4,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=7,0,0)) = "Redemptions",false,true), Parameters!View.Count = 8,
IIF(Parameters!View.Value(iif(Parameters!View.Count=8,7,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,6,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,5,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,4,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=8,0,0)) = "Redemptions",false,true)
)