SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 ssrs 2008 r2 complex iif statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

308 Posts

Posted - 10/03/2013 :  18:18:27  Show Profile  Reply with Quote
In an ssrs 2008 r2 report, I found the following expression that I am trying to understand what it means:

=iif(Fields!Gr.Value = "01", "01 Total Score",
iif(Fields!Gr.Value = "02", "02 Total Score",
iif(Fields!GradeLevel.Value = "03", "04 Total Score",
"All Levels"))))

I think it means the following

If Fields!Gr.Value = "01", then value = "01 Total Score",

else If Fields!Gr.Value = "02", then value = "02 Total Score",

else If Fields!Gr.Value = "03", then value = "03 Total Score",

else (for anything else, the value is "All Levels".

Can you tell me if my assumption is true or not? If not, would you tell me what this statement really means?

Also would you point me to a url that explains this kind of logic structure for ssrs 2008 r2?

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/04/2013 :  02:03:15  Show Profile  Reply with Quote
yes. your assmuption is correct. It uses a set of nested IIF to check the various conditions.
The above nested iifs can be simplified using Switch statement like

=Switch(Fields!Gr.Value = "01", "01 Total Score" ,
Fields!Gr.Value = "02", "02 Total Score",
Fields!Gr.Value = "03", "03 Total Score",
1=1, "All Levels")

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jassie
Constraint Violating Yak Guru

308 Posts

Posted - 10/04/2013 :  09:47:03  Show Profile  Reply with Quote
Thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000