SSRS nested iif expression in lookup

2019-06-05 20:14发布

问题:

I'm brand new to SSRS and could use some help: is it possible to nest a lookup expression inside an iif statement? I have a web form with checkboxes and would like to change the answer text from "True" and "False" to "Agree" and "Disagree", but because I'm using a lookup expression to get the responses, I can't use a simple iif statement. When I try to use two Expressions, I get an error message. Here are my expressions:

=iif(ReportItems!Textbox70.Value = true, "Agree", "Do not agree")
=Lookup(22, Fields!QuestionID.Value, Fields!ResponseDisplayText.Value, "ApplicationData")

回答1:

Yes it is possible to nest a lookup expression inside an iif statement.

Your code should look like the following:

=iif(Lookup(22, Fields!QuestionID.Value, Fields!ResponseDisplayText.Value, "ApplicationData"), "Agree", "Do not agree")

Also just for future reference, remember that when using scopes inside nested logic (such as "ApplicationData") you may run into some problems with SSRS if the innermost scope values are larger than/ different than the scope of the outermost values.

Hope that helps!