Change color of text object using formula in Crystal Reports

83,176

Solution 1

Follow these steps:

  1. Right click field: select Format Field...
  2. Select Font tab, then click conditional-formula button to the right of the color picker
  3. Enter this formula: If {mnth_ttx.weight}>0 Then crRed Else crBlack

Solution 2

Follow these steps:

  1. Right click field: select Format Field.
  2. select font tab.
  3. click on the X+2 box directly to the right of the color picker. The Formula Editor will open.
  4. Enter this formula:

    If {mnth_ttx.weight}>0 
      Then crRed 
    Else crBlack
    

Solution 3

You can use the tried-and-true "currentfieldvalue" evaluation.

  1. Right click on your element and hit "Format Field"

  2. In the Font tab, click on the edit button for "Color".

  3. Enter this:

    if currentfieldvalue > 0 then crRed else crBlack
    
  4. That's all she wrote

Share:
83,176
itzArun
Author by

itzArun

Updated on January 09, 2021

Comments

  • itzArun
    itzArun over 3 years

    enter image description hereI want to change the color of the text in text object using formula in Crystal Report. I tried like

    If {mnth_ttx.weight}>0 Then
      crRed;
    

    But the color is not changing at run time. I wrote this condition under formula edit of weight text object. But not working. How to change the color of a text using formula