If and Then in SSRS

  • Hi

    i have a table in my report.I want to display the name field as BOLD if the Amount field is 0.ELse the name field must be italic.

    i am using SSRS 2005

    How is this done..

    thanks in advance...!!

  • Almost every property in SSRS can be set through an expression as well as directly entering a value. Right-click the Name text-box, and select text-box properties. Select the "Font" tab. Right beside the "Bold" checkbox is a button (fx) - click this, and in the dialog box that appears you can enter an expression for calculating the FontWeight. Note that the result needs to be a string.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Hi,

    All you need to is select the relevent cell in your table and then in the properties window (press f4 if you can't see it)

    under the font heading you will see fontstyle (you will also see fontweight and will need a separate expression for this), you need to click on the drop down list next to them and select expression from the list. You will need to type something like

    =iif(fields!myamountfield.value = 0,"italic","Normal")

    You will need an expression for fontweight as well

    =iif(fields!myamountfield.value = 0,"bold","Normal")

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply