cancel
Showing results for 
Search instead for 
Did you mean: 

Change The Color Of Fomula Field Based On Results

Former Member
0 Kudos

I am using Crystal XI and I am familar with the Highliting Expert, but my question is can I have a formula field print red on the report based on a certain condition, blue on a different condition, etc. I am not sure how to code this if possible, so I will give an example:

If Sales ($100) - Cost ($50) = Profit ($50) then print field red

else if Sales ($80) - Cost ($40) = Profit ($40) then print field green

else print field blue.

I will need to add additional criteria to each IF statement which is why I am not using the Highliting Function, so my basic question is how to code the formula to have field field print different colors based on the field values.

Any help would be geatly appreciated.

Thanks Jim

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank You for your response. and it has resolved my issue

Former Member
0 Kudos

Is this possible to do for all fields in the record or do I need to enter that formula for each field separately? For instance, I want all fields in the row to be red for a certain condition and black for another condition. Is there a way to do this for all the fields at once?

Former Member
0 Kudos

Hi,

Yes it is possible

1 Select multiple fields

2 Right click and clickon format objects

3 Goto font tab click on X-2 in front on color

4 Write condition

Sample code:

if ({Customer.Last Year's Sales} > 5000 ) then crteal

Former Member
0 Kudos

Worked! Thanks.

Former Member
0 Kudos

hola a todos!! quisiera saber si es posible que en vez de cambiarle el color al texto, validara que si el campo oinv.printed = 'Y' no muestre nada o que la letra fuera blanca para que la impresion no se viera

esto con el fin de que cuando ya se haya impreso , la copia no salga nada o sea vacia

former_member183750
Active Contributor
0 Kudos

Please see my response at:

http://scn.sap.com/thread/3181796

- Ludek

Former Member
0 Kudos

Hi Jim,

Right click the field >> Format >> Font Tab.

Find 'color' >> Click the little icon with a pencil and X-2 symbol to open the formula box.

Place your formatting formula in the box:


If @Sales - @Cost < 0 Then
     Formula = crRed
ElseIf @Sales - @Cost >= 50 Then
     Formula = crGreen
Else
     Formula = crBlue
End If

Full list of Color Constants are in the functions list of the Formula Editor.

Art