Solved

SSRS Expression IIF Statements

Posted on 2016-09-26
2
34 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
2 Comments
 
LVL 12

Accepted Solution

by:
Arifhusen Ansari earned 500 total points
Comment Utility
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 13

Expert Comment

by:Megan Brooks
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Written by Valentino Vranken. A while ago I wrote an article called Chart Optimization Tips (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Chart-Optimization-Tips.html).  This article explained how …
Introduction: This article is aimed at report developers who are used to developing reports using relational databases and have gotten a first-time assignment to develop reports on OLAP cubes. It demonstrates how to build a report using SQL Ser…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now