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)
)

After reviewing the guru's code, Jonathan realized that he could have taken a much simpler approach, and in fact he managed to reproduce the above for the new parameter with a single line of code.

=Join(Parameters!Views.Value, ",").Contains("Overview")

Jonathan's peers were amazed. Such elegance. Such skill. Jonathan's managers who weren't nearly as technical did not share the same level of "amazement". Instead they were simply relieved.

At long last, they had found their replacement guru.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!