August 10, 2012 at 7:19 am
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
August 10, 2012 at 7:37 am
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
August 10, 2012 at 7:53 am
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.
August 10, 2012 at 8:36 am
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.
August 10, 2012 at 8:41 am
Thanks. Can you provide a simple example of the switch function? I might use it in the future.
August 10, 2012 at 8:46 am
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.
August 10, 2012 at 8:51 am
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