Solved

SSRS Expression IIF Statements

Posted on 2016-09-26
2
49 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
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 14

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In this short article I will be talking about two functions in the SQL Server Reporting Services (SSRS) function stack.  Those functions are IIF() and Switch().  And I'll be showing you how easy it is to add an Else part to the Switch function. T…
Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

775 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