April 17, 2009 at 7:30 am
I'm working with a report that has two query parameters: State, and AR. Based off what a person enters, I want lines in the report to show.
1. If both fields are blank (default is set to blank), everything should show.
2. If the row's state value = the state parameter's value AND the row's AR value = the AR parameter's value, that line should show.
3. If the row's AR = the AR parameter's value AND state is blank, that line should show.
4. If the row's State = the State parameter's value AND AR is blank, that line should show.
I'm using the hidden property to make the row appear/disappear. Here's what I have:
=IIf(Parameters!Report_Parameter_AR.Value = "" AND Parameters!Report_Parameter_State.Value = "", False, IIf(Fields!AR.Value = Parameters!Report_Parameter_AR.Value AND Fields!State.Value = Parameters!Report_Parameter_State.Value, False, IIf(Fields!AR.Value <> Parameters!Report_Parameter_AR.Value AND Parameters!Report_Parameter_State.Value = "", True, IIf(Parameters!Report_Parameter_AR.Value = "" AND Fields!State.Value <> Parameters!Report_Parameter_State.Value, True, False))))
It's working for everything except #2. Is there something wrong with my expression?
Thanks for any help!
April 17, 2009 at 8:12 am
I changed your expression to use Switch which I think is easier to read and it looks okay to me:
=Switch(Parameters!Report_Parameter_AR.Value = "" AND Parameters!Report_Parameter_State.Value = "", False,
Fields!AR.Value = Parameters!Report_Parameter_AR.Value AND Fields!State.Value = Parameters!Report_Parameter_State.Value, False,
Fields!AR.Value Parameters!Report_Parameter_AR.Value AND Parameters!Report_Parameter_State.Value = "", True,
Parameters!Report_Parameter_AR.Value = "" AND Fields!State.Value Parameters!Report_Parameter_State.Value, True,
False
)
The only other recommendation that I would make is that I would change the 2 conditions that you have set to return True to the combinations that would return False and have my final result if no conditions are met return True.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 17, 2009 at 8:40 am
I couldn't get the switch statement to work, but I did get what I was looking for after changing around the way I wrote things. This is what I came up with:
=IIf(Parameters!Report_Parameter_AR.Value = "" AND Parameters!Report_Parameter_State.Value = "", False, IIf(Fields!AR.Value = Parameters!Report_Parameter_AR.Value AND Fields!State.Value = Parameters!Report_Parameter_State.Value, False, IIf(Fields!AR.Value = Parameters!Report_Parameter_AR.Value AND Parameters!Report_Parameter_State.Value = "", False, IIf(Parameters!Report_Parameter_AR.Value = "" AND Fields!State.Value = Parameters!Report_Parameter_State.Value, False, True))))
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply