Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

font color expression

hi everyone,

I have a text box which calculates the % change between Budget and Actual. If the % change is negative, I want the font to be red. If it is positive, I want it to be green.

My expression in the text box to calculate % change is working fine: =num((sum(Budget)/sum(Actual)-1),'#.#0%'). However, I cannot get the calculated font color to work. Here's my expression:

=if((sum(Budget)/sum(Actual)-1)>0,'Green','Red')

Any ideas on how to fix the syntax are appreciated!

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

The codes that Rebecca posted had a translucency value of zero - which would have made your text transparent.  You could make those first values 255, or not use the colour codes with the translucency modifier, eg.

RGB(0,128,0) and RGB(128, 0, 0)

I find these functions more simple to understand anyway, as everyone expects just R, G and B values.

The other thing worth noting that as you have a very simple criteria you could ignore the Font Color expression and do this using the Visual Cues tab.  This way you can define which colours should be shown based on the value of the field - and you get to use the colour picker dialog.  There are lots of situations where you do need to use the font colour expression though.

Hope that helps,

Steve

http://www.quickintelligence.co.uk/

View solution in original post

8 Replies
fdelacal
Specialist
Specialist

go to font, then color

then calculate and do.

if(sum(Budget)/sum(Actual)-1)>0,argb(255,0,255,0),argb(255,255,0,0))

hope that helps you.

regards.

Not applicable
Author

thank you- works like a charm!

fdelacal
Specialist
Specialist

excelent!

Not applicable
Author

though i do have a question - would there be a way to change the shades of red and green? I would ideally have wanted a darker set of colors but typing in their RGB codes didn't do it for me.

more specifically, the green i wanted was RGB (0,128,0) and the red was (128,0,0)

Not applicable
Author

Hi,

You only need to modify the RGB color expression!

ARGB(0,0,128,0) and ARGB(0,128,0,0)

Rebeca

Not applicable
Author

sadly that just wiped out my text thanks for the idea though!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

The codes that Rebecca posted had a translucency value of zero - which would have made your text transparent.  You could make those first values 255, or not use the colour codes with the translucency modifier, eg.

RGB(0,128,0) and RGB(128, 0, 0)

I find these functions more simple to understand anyway, as everyone expects just R, G and B values.

The other thing worth noting that as you have a very simple criteria you could ignore the Font Color expression and do this using the Visual Cues tab.  This way you can define which colours should be shown based on the value of the field - and you get to use the colour picker dialog.  There are lots of situations where you do need to use the font colour expression though.

Hope that helps,

Steve

http://www.quickintelligence.co.uk/

Not applicable
Author

Thank you both!!