Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Reporting services IIF

Author  Topic 

dzabor
Posting Yak Master

138 Posts

Posted - 2011-05-31 : 13:40:07
I am trying to get a nested IIF statment to work in RS, but cannot find the correct syntax.

I need it to accomplish the following:
1. If the CreditCardType value = Credit Card and The payment Type = "A' , then return AMEX
2.If the CreditCardType value = Credit Card and The payment Type = "M' , then return Master Card
3. If the CreditCardType value = Credit Card and The payment Type = "V' , then return Visa
4. If If the CreditCardType value = Check the return "Check


=Fields!PaymentType.ValueFields!PaymentType.Value, Fields!PaymentType.Value, IIF(Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "A", "AMEX,
IIF(Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "M", "Master Card",
IIF(Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "V", "Visa", "")

Thanks,
Debi

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-31 : 15:03:20
Based on your description, I would think you want something like this:
=IIF
(
Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "A",
"AMEX",
IIF
(
Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "M",
"Master Card",
IIF
(
Fields!PaymentType.Value = "Credit Card" and Fields!CreditCardType.Value = "V",
"Visa",
IIF(Fields!PaymentType.Value = "Check","Check","" )
)
)
)
Go to Top of Page

dzabor
Posting Yak Master

138 Posts

Posted - 2011-05-31 : 16:20:13
That worked! Thanks!

D
Go to Top of Page
   

- Advertisement -