简体   繁体   English

Crystal Reports 2008-选择语句以更改背景颜色

[英]Crystal Reports 2008 - Select statement to change background color

I am trying to change the background color using a select/case statement. 我试图使用select / case语句更改背景颜色。 However, I need to compare two fields in the same select statement. 但是,我需要在同一条select语句中比较两个字段。

{@Color_1} will display "1A" or "2A" {@Color_2} will display "1B", "2B", "3B", or "4B" {@ Color_1}将显示“ 1A”或“ 2A” {@ Color_2}将显示“ 1B”,“ 2B”,“ 3B”或“ 4B”

I have tried and I get an error 我尝试过,但遇到错误

select {@Color_1},{@Color_2}
case "1A": crRed
case "2A": crYellow:
case "1B": crRed
case "2B": crYellow
case "3B": crRed
case "4B": crYellow
default: crNoColor

and also tried and none of the fields have color: 并且也尝试过,所有字段都没有颜色:

stringvar tag :={@Color_1};
stringvar tag :={@Color_2};

select tag 
case "1A":
crRed
case "2A":
crYellow
case "1B":
crRed
case "2B":
crYellow
case "3B":
crRed
case "4B":
crYellow
default: crNoColor

I have also tried multiple IF, Then, Else combinations and it still does not work. 我还尝试了多个IF,然后,其他组合仍然无法正常工作。 Can someone provide a solution....PLEASE?!?! 有人可以提供解决方案吗?...请?!?!

It's been a few days, so you've probably solved it on your own by now. 已经过了几天,所以您现在可能已经自己解决了。 If not, try this: 如果没有,请尝试以下操作:

  1. Select the field whose background you want to change. 选择要更改其背景的字段。
  2. For this field, go into it's Properties menu, then Border , then the X-2 custom formula button. 对于此字段,请进入“ 属性”菜单,然后依次单击“ 边框”X-2自定义公式按钮。
  3. Try putting your criteria in this format: 尝试将您的条件设置为以下格式:
 If {@Color_1}="1A" then crlime else if {@Color_2}="2b" then cryellow else crnocolor 

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

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