水晶报告突出显示

问题描述 投票:0回答:1

我在水晶报表中有一个字段,我想根据多个条件突出显示该字段。 我无法找到一种方法来让 switch 和/或 if 语句为我工作。 这是一份生产力报告。有两种方法可以提高生产力:不进行调整或进行调整。 如果有帮助的话,我的目的是如果数字在一定范围内则以黄色突出显示。它告诉用户查看此人的分数,因为他们非常接近获得下一个未调整的奖金级别。当以橙色突出显示时,它将表明他们非常接近下一个调整后的奖金级别(它会根据他们的任何休息时间进行调整,并降低他们有资格获得奖金所需的分数,但也会减少奖金)。

任何帮助表示赞赏!

因此,如果需要,代码首先以黄色突出显示,然后如果需要,则以橙色突出显示,无论它是否以黄色突出显示。 请注意,我执行 else NocrColor 的原因是因为出于某种原因它会以黑色突出显示。

下面的第一个代码检查未调整的。 无论如何我想运行以下代码:

IF ISNULL({Productivity_Bonuses.Credits}) or {Productivity_Bonuses.Credits} = 0 THEN 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} 
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency}) 
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} 
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency}) 
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency}
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency})) 
    then crYellow
else crNoColor
ELSE //ISNULL({Productivity_Bonuses.Credits}) is false and {Productivity_Bonuses.Credits} <> 0
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)))
    then crYellow
else crNoColor

但是我也想运行以下代码来调整奖金,但前提是 Productivity_Bonuses.Bonus_Percent} <> 1:

IF ISNULL({Productivity_Bonuses.Credits}) or {Productivity_Bonuses.Credits} = 0 THEN 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} 
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}) 
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}  
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}) 
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} 
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent})) 
    then color(245, 176, 65)
else crNoColor
ELSE 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)))
    then color(245, 176, 65)
else crNoColor
if-statement crystal-reports switch-statement highlight
1个回答
0
投票

我在另一个堆栈溢出问题上找到了答案:

使用现有代码执行此操作的最简单方法是将 if 块括在括号中并用分号分隔:

Crystal Report:如何计算一个公式中的多个 IF 语句?

(IF ISNULL({Productivity_Bonuses.Credits}) or {Productivity_Bonuses.Credits} = 0 THEN 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} 
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency}) 
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} 
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency}) 
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency}
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency})) 
    then crYellow
else crNoColor
ELSE //ISNULL({Productivity_Bonuses.Credits}) is false and {Productivity_Bonuses.Credits} <> 0
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * ((100 - {Productivity_Bonuses.Credits}) / 100)))
    then crYellow
else crNoColor
);

(if  {Productivity_Bonuses.Bonus_Percent} <> 1 then
IF ISNULL({Productivity_Bonuses.Credits}) or {Productivity_Bonuses.Credits} = 0 THEN 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} 
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}) 
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}  
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent}) 
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} 
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent})) 
    then color(245, 176, 65)
else crNoColor
ELSE 
if (({Productivity_Bonuses.Revenue} < 18000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 17500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 16000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 15500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100))
or ({Productivity_Bonuses.Revenue} < 14500 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)
and {Productivity_Bonuses.Revenue} >= 14000 * {MPC_OPData.FullTime_Equivalency} * {Productivity_Bonuses.Bonus_Percent} * ((100 - {Productivity_Bonuses.Credits}) / 100)))
    then color(245, 176, 65)
else crNoColor
);
© www.soinside.com 2019 - 2024. All rights reserved.