Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 ssrs 2008 r2 complex iif statement Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, October 3, 2013 4:16 PM
 Mr or Mrs. 500 Group: General Forum Members Last Login: Yesterday @ 4:03 PM Points: 563, Visits: 697
 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?
Post #1501372
 Posted Friday, October 4, 2013 4:12 AM
 SSC Veteran Group: General Forum Members Last Login: Tuesday, November 22, 2016 9:43 AM Points: 293, Visits: 2,200
 Yes your assumption is correct.For readability this could be better done as a switch statement:`=Switch( Fields!Gr.Value = "01", "01 Total Score", Fields!Gr.Value = "02", "02 Total Score", Fields!GradeLevel.Value = "03", "04 Total Score", true, "All Levels")`Switch evaluates the conditions in order and stops when the first one is true.The true condition at the end means this value will always be returned if none of the other conditions have been true.Don't know any URLs but you seem to understand what it's doing anyway.
Post #1501507

 Permissions