Solved

SSRS Expression IIF Statements

Posted on 2016-09-26
2
87 Views
Last Modified: 2016-09-27
Hi,

I have the below iif statement within my expression. How can I take this further to perform further actions if the result is in fact "B"?

[code][/=IIf(
            (
                  iif
                  (
                        Fields!MandateReference.Value Like "*85397"
                        OR Fields!MandateReference.Value Like "*85398"
                        OR Fields!MandateReference.Value Like "*85399", Fields!Local_Currency.Value," "
                  )
                  /
                  (
                        iif
                        (
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00001"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00002"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00003",
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!Local_Currency.Value, "d_ExcludedHoldingsGFS")," "
                        )
                        +
                        iif
                        (
                              (Fields!MandateReference.Value Like "*85397"
                              OR Fields!MandateReference.Value Like "*85398"
                              OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                        )
                  )
                  >= 0.5
            )
            OR
            (
                  iif
                  (  
                        (Fields!MandateReference.Value Like "*85397"
                      OR Fields!MandateReference.Value Like "*85398"
                      OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                  )
                  /
                  (
                        iif
                        (
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00001"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00002"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00003",
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!Local_Currency.Value, "d_ExcludedHoldingsGFS")," "
                        )
                        +
                        iif
                        (  
                              (Fields!MandateReference.Value Like "*85397"
                              OR Fields!MandateReference.Value Like "*85398"
                              OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                        )
                  )
                  <= 0.3
            ), "A", "B"
     )code]

Thanks.
0
Comment
Question by:Martin Spalding
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Arifhusen Ansari earned 500 total points
ID: 41816064
You meant to say that if condition went false then you want to do some other validation.
Right?

If this is the case. You can use the iif expression same in the part B of your code.



IIf(
            (
                  iif
                  (
                        Fields!MandateReference.Value Like "*85397"
                        OR Fields!MandateReference.Value Like "*85398"
                        OR Fields!MandateReference.Value Like "*85399", Fields!Local_Currency.Value," "
                  )
                  /
                  (
                        iif
                        (
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00001"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00002"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00003",
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!Local_Currency.Value, "d_ExcludedHoldingsGFS")," "
                        )
                        +
                        iif
                        (
                              (Fields!MandateReference.Value Like "*85397"
                              OR Fields!MandateReference.Value Like "*85398"
                              OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                        )
                  )
                  >= 0.5
            )
            OR
            (
                  iif
                  (  
                        (Fields!MandateReference.Value Like "*85397"
                      OR Fields!MandateReference.Value Like "*85398"
                      OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                  )
                  /
                  (
                        iif
                        (
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00001"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00002"
                              OR Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!MandateReference.Value, "d_ExcludedHoldingsGFS") Like "*00003",
                              Lookup(Fields!MandateReportingName.Value, Fields!MandateReportingName.Value, Fields!Local_Currency.Value, "d_ExcludedHoldingsGFS")," "
                        )
                        +
                        iif
                        (  
                              (Fields!MandateReference.Value Like "*85397"
                              OR Fields!MandateReference.Value Like "*85398"
                              OR Fields!MandateReference.Value Like "*85399"), Fields!Local_Currency.Value," "
                        )
                  )
                  <= 0.3
            ), "A", IIF ( Your new condition , true part, falsepart)
     )
0
 
LVL 16

Expert Comment

by:Megan Brooks
ID: 41816119
Keep in mind that IIF is just a shorthand way of writing a searched CASE, for simple expressions. You might end up with a more readable and easier to debug query if you used CASE.
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question