繁体   English   中英

Crystal Reports使用IF语句更改字段颜色

[英]Crystal Reports changing field color using IF statement

我试图根据比较两个数据字段来更改水晶报表中一行的背景颜色。 例如。 If GPA_01 < GPA 02 then the background color should be red. else the background color should be white If GPA_01 < GPA 02 then the background color should be red. else the background color should be white 尝试创建公式时,我收到一条error message saying the " a number is expected here" ,在此情况下,在比较符号后加亮该字段。 我在想<之后的字段需要转换为数字,但是我不确定该怎么做。

任何建议将不胜感激。

假定两个字段是数字,请尝试:

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

使用CINT()转换为整数

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM