Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change color of text object using formula in Crystal Reports

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

like image 706
itzArun Avatar asked Feb 03 '12 07:02

itzArun


People also ask

How do you color in Crystal Reports?

In Crystal Reports, right click on a text object or database field, and select "Format..." In the "Format Editor", under the tab "Border", check the option "Background", and select a color.

How do I use conditional formatting in Crystal Reports?

To write a conditional formatting formula, right-click the report and click Format Result Object element → select the property on which you want to apply conditional formula → click and it will open formula workshop. Write the formula in the formula text pane, save and close it.

How do you use special fields in formula in Crystal Reports?

To insert special fields in Crystal Reports, click the small plus sign next to the “Special Fields” entry within the “Field Explorer” pane. Click the name of the special field that you want to insert into the report and then click the “Insert to Report” button in the toolbar of the “Field Explorer” pane.


3 Answers

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
like image 87
craig Avatar answered Jan 01 '23 15:01

craig


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
    
like image 38
joohitha Avatar answered Jan 01 '23 14:01

joohitha


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

like image 42
Gus Lopez Avatar answered Jan 01 '23 14:01

Gus Lopez