Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Highlight Background Post Reply Post New Topic
Author Message
tcrow59
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 6
Quote tcrow59 Replybullet Topic: Highlight Background
     Posted: 07 Feb 2013 at 9:10am
Hello:

I'm trying to highlight a field on a report if it meets a certain condition. I can't use Highlight Expert due to the syntax I need to use. Using the border/background formula I've entered:

if {@MTD 2011 Tons} < {@MTD 2010 Tons} Then cryellow
else crnocolor

Seems simple but I get no results. Any suggestions would be appreciated
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2013 at 10:29am
what are those two formulas?
IP IP Logged
tcrow59
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 6
Quote tcrow59 Replybullet Posted: 07 Feb 2013 at 10:38am
They're month to date tonnages for a specific client in subsequent years.

MTD 2010 Tonnage = 261
MTD 2011 Tonnage = 198
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2013 at 11:07am
so you are using whileprintingrecords in it?
IP IP Logged
tcrow59
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 6
Quote tcrow59 Replybullet Posted: 07 Feb 2013 at 11:51am
Yes.

Whileprintingrecords;
if {@MTD 2011 Tons} < {@MTD 2010 Tons} Then cryellow else crnocolor

Both are summary fields.

The field formula for MTD 2001 Tons:

If {vw_Scale_Tickets_Material_Detail.TicketDate} >= date(year(currentdate)-2,month(currentdate),1) and
{vw_Scale_Tickets_Material_Detail.TicketDate} <= dateadd("yyyy",-2,currentdate)-1 then
{vw_Scale_Tickets_Material_Detail.MatUnits}/2000

MTD 2010 tons is similar.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2013 at 12:07pm
the formula you gave is only evaluating for one row. In order to make it summarized for your data set you would need to apply a summary to to it.
I don't know your data set so I am not sure of your process here but usually there is a sum of the result which is then / by a number.
Place your MTD 2010 Tons formual on the detail section and see if you get the value you expectr for each row.
are you getting the right value?
 
 
If not, this is all a guess but maybe change your 2010 formula to
 
 
If {vw_Scale_Tickets_Material_Detail.TicketDate} in date(year(currentdate)-2,month(currentdate),1) to dateadd("yyyy",-2,currentdate)-1 then {vw_Scale_Tickets_Material_Detail.MatUnits}
 
then sum that and divide by 2000.
sum({@MTD 2010 Tons}) / 2000
IP IP Logged
tcrow59
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 6
Quote tcrow59 Replybullet Posted: 07 Feb 2013 at 12:30pm
Thanks DBlank

I'm not sure I understand your post.
Both fields are summary fields in a group. The formulas for the fields work correctly and if i use the Highlight Expert the proper fields are highlighted, unfortunately Highlight Expert requires me to enter a numeric value and not compare against another field.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum