Question : IIF Condition statement

Using reporting services I am trying to set the visibility on a text box using the IIF condition.

if parameter value != -1 then show report
else if parameter value = -1 and parameter value => -1 then show report
else if parameter value = -1 then hide report and show error message

Can someone please provide me with the correct syntax ?

Thanks!

Answer : IIF Condition statement

Hi Waylon
Are you just using one parameter? Also are you designing your report in Visual studio?
I am assuming that your answer is yes to both my questions.

Looking at your statement:

if parameter value != -1 then show report
else if parameter value = -1 and parameter value => -1 then show report
else if parameter value = -1 then hide report and show error message

Basically your statement is saying:
(1st line)if the value is not equal to -1 then show the report
(2nd line) if the value is -1 or greater than  or equal to -1 then show the report
(3rd line) if the value is -1 then hide the report and show an error message.

As an example, if you selected -1, then you will never reach the 3rd line because the 2nd line will run since it checks for -1there and if true then it will show the report.

Try this version in your visibility expression of your textbox:

=IIF( Parameters!Users.Value<-1 OR  Parameters!Users.Value>-1,FALSE,TRUE)

Which basically says, if the value isnt -1 then show else hide the textbox. How are you showing the error message? Is this another textbox? if so then you can set the visibility to show when the value is -1 else hide it.

=IIF( Parameters!Users.Value=-1,FALSE,TRUE)

Hope this helps

Rob
Random Solutions  
 
programming4us programming4us