web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SSRS Expression Switch Statement

(0) ShareShare
ReportReport
Posted on by 353

Hi - 

   I need to write an Expression in Visual Studio 2013  containing the Logic as written below. 

IF (WFRegionalID == "USA" && WFDisplayPrintCOA == 1)
{

print ("[XX] Certificate of Analysis");

}

else

{

print ("[  ] Certificate of Analysis")

}

The problem Im facing is that I cant seem to come up with the code which compares two values like (WFRegionalID == "USA" && WFDisplayPrintCOA == 1) . 

Can you please suggest me how I can write this logic in Visual Studio Expression ? 

As of now I have this line of code in my expression and it works I just need to add an extra flag which checks for the value of WFRegionalID  along with WFDisplayPrintCOA at the same time.

=Switch(Fields!WFdisplayPrintCOA.Value = 1 , "[XX] Certificate of Analysis", 1=1, "[   ] Certificate of Analysis") 

Thanks 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Muhammad_Ali,

    Try =iif((Fields!WFdisplayPrintCOA.Value = 1) AND (WFRegionalID = "USA"),  "[   ] Certificate of Analysis", "")

  • Community Member Profile Picture
    on at

    you can write both if conditions, one in the first line click enter and the second in the next line, both logic will execute in the order you set it.

    or you can use the switch statement.

    Are you using the visibility condition?

  • Muhammad_Ali Profile Picture
    353 on at

    thank you for the reply ievgen but unfortunately your line of code is not getting the correct results. It is always evaluated to this "".

    The code I have written is this

    =IIf(Fields!WFdisplayPrintCOA.Value = 1 AND Fields!CountryRegionId.Value  = "USA",  "[XX] Certificate of Analysis", "[] Certificate of Analysis")

  • Muhammad_Ali Profile Picture
    353 on at

    Hi Tatiana Garcia Ramos -

     No I'm not using the visibility condition.

    I was using switch originally but I dont know how to compare two expressions in one switch condition. If we can do this with IFF its fine but I need to know the syntax.

    Thanks

  • Mea_ Profile Picture
    60,286 on at

    It can't evaluate to "" because that's an "if" statement it should return either [XX] Certificate of Analysis or [] Certificate of Analysis, are you sure that there is no syntax error ?

  • Muhammad_Ali Profile Picture
    353 on at

    ievgen sorry typo on my part. It is always evaluated to [] Certificate of Analysis.

    No syntax error. I have pasted the exact code from the expression box.

  • Muhammad_Ali Profile Picture
    353 on at

    =IIf(Fields!WFdisplayPrintCOA.Value = 1 AND Fields!CountryRegionId.Value  = "USA",  "[XX] Certificate of Analysis", "[] Certificate of Analysis")

  • Mea_ Profile Picture
    60,286 on at

    that means that "Fields!WFdisplayPrintCOA.Value = 1 AND Fields!CountryRegionId.Value  = "USA"" is false.  Did you check that WFdisplayPrintCOA is 1 and CountryRegionId is "USA" ? It's easy to do, just put them into another column.

  • Muhammad_Ali Profile Picture
    353 on at

    Ievgen Yes I made sure that both the fields have the correct value. But still for some reason the If statement is always evaluated to "[] Certificate of Analysis".

    what do you mean put them into another column ? You mean add a new column and use the same code to see if it works ?

    Thank You

  • Mea_ Profile Picture
    60,286 on at

    maybe Fields!WFdisplayPrintCOA.Value is string not int, try Fields!WFdisplayPrintCOA.Value = "1"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans