Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF Expression with Scope

Status
Not open for further replies.

tipofapin

Technical User
May 6, 2010
6
US
I am using SSRS 2008 R2 with SQL 2008. I have a report that lists dates that a client uses a service. I have grouped on the client name and the detail is the dates. I am trying to check if a date for a specific client is duplicated. To do that I am using an IIF statement.

=IIF(Fields!SvcDate.Value,"table1_ClientName"=Previous(Fields!SvcDate.Value,"table1_ClientName", "Khaki", "White"))

---------------------
Joe Schmoe 8/1/12
---------------------
John Smith [highlight #FCE94F]8/1/12[/highlight]
8/8/12

If I run this expression without the scope in it, it colors the field correctly, but of course the previous part of this means that if another client directly above has the same date, this expression thinks that is the previous date and I get a background color. So I need to make sure that the colors and the previous criteria are limited to each individual client. The expression above gives an error that says that there is no False part to the statement. So I'm thinking that I have the parentheses wrong somehow, but I can't figure out how to correct it. Can anyone help me out?
 
Try moving one of your closing parenthesis prior to the comma before "Khaki".


=IIF(Fields!SvcDate.Value,"table1_ClientName"=Previous(Fields!SvcDate.Value,"table1_ClientName"), "Khaki", "White")
 
Thanks for the suggestion.. But now I get an error that essentially says that there are "Too many arguments".
 
I just wanted to post the solution that I used to resolve this issue, so that anyone else who might run into this can have an alternate answer. [lipstick2]
This is what I used to get the highlighting within a group.

=iif(Fields!ClientName.Value = Previous(Fields!ClientName.Value) and Fields!SvcDate.Value = previous(Fields!SvcDate.Value),"khaki","white")

I hope this is helpful to someone else!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top