0
votes

I am trying to change the background color of a row in crystal reports based on comparing two data fields. For example. If GPA_01 < GPA 02 then the background color should be red. else the background color should be white. When attempt to create the formula i get an error message saying the " a number is expected here" it's highlighting the field after the comparison sign in this case the <. I'm thinking the field after the < needs to be converted to a number but I'm not sure how to do that.

Any advice would be greatly appreciated.

3

3 Answers

0
votes

Assuming that the two fields are numeric, try:

If {table.GPA_01} < {table.GPA 02} Then
  crRed
Else
  crNoColor
0
votes

use CINT() to convert to integer

If CINT({table.GPA_01}) < cINT({table.GPA 02}) Then
  crRed
Else
  crNoColor
0
votes
If CINT({table.GPA_01}) < cINT({table.GPA 02}) Then
'crRed'
 Else
 'crNoColor'