formatting numbers

  • Hello all,

    Im formatting a field and have a question. I want my negatives to show up in RED with parentheses rather than, for example, -5,100.

    Any ideas?

    Thanks,

    Mike

  • I think you can set the formatting for a column by setting a property on it. I know I've done what you're asking about before, but it's been a while. Try setting the format of the column in the report, in its properties.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thanks for the response, but I got it figured out. It's a two part formatting process, one for the parenthesis and one for the color.

    In the properties dialog box for the textbox, code the following:

    FORMAT (for Parenthesis):

    #,##0;(#,##0)

    In the COLOR section:

    =IIF(Fields!FREECASH_AMOUNT.Value > 0, "black","red")

    Pretty simple.

  • Another one for the colour would be to use the switch function as well, but IIF does it just as good.

    Tyipcally I use switch as it can be a bit tricky to follow multiple nested IIF calls, but IIF ok if its 1 or 2 checks, IMO.

  • Thanks. Can you provide a simple example of the switch function? I might use it in the future.

  • Pretty much the same as IIF but if you want to do >0 and then a different colour for > 10 you would have

    =IIF(Fields!FREECASH_AMOUNT.Value > 0, "black",IIF(Fields!FREECASH_AMOUNT.Value > 10, "black","yellow")))

    So you can see the more IIF's you put in the harder it could get to read.

    For switch you would do something like, the only proble with SWITCH is that it will only take the first true expression, so if the value is > 0 and also >10 the below would return red,

    =SWITCH(

    Fields!FREECASH_AMOUNT.Value > 0 "black","red",

    Fields!FREECASH_AMOUNT.Value > 10 "black, "yellow"

    )

    So you would do the below so is the value > 10 yes yellow, no evaluate next expression > 0 yes red

    =SWITCH(

    Fields!FREECASH_AMOUNT.Value > 10 "black, "yellow",

    Fields!FREECASH_AMOUNT.Value > 0 "black","red"

    )

    Hope that makes sence.

  • I see, makes perfect sense. Thanks for the tip.

Viewing 7 posts - 1 through 6 (of 6 total)

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