Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formatting font for field Post Reply Post New Topic
Author Message
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Topic: Formatting font for field
     Posted: 24 Sep 2013 at 3:19am
I have a date field that is formatted with a formula. It is RED if the date is 30 days old from the current date AND the next date is equal to 1/1/1753 (which, in the data table means null).
if {OPPOR.ENDDAT_1} <= currentdate -30 and
{OPPOR.ENDDAT_2} = date(1753,1,1) then
crRed else crBlack
 
What I would like to do, is add another condition that makes the font GREEN if the date is within a week of currentdate ( >= currentdate -7.
 
When I try to add this other condition, I keep getting a boolean error. How do I add this 2nd condition so the date font is either RED, GREEN, or Black (when there is an actual activity date in the next date field).
Be kind to those less fortunate.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Sep 2013 at 4:43am
if {OPPOR.ENDDAT_1} <= currentdate -30 and {OPPOR.ENDDAT_2} = date(1753,1,1) then
if {OPPOR.ENDDAT_1} <= currentdate -7 and {OPPOR.ENDDAT_2} = date(1753,1,1) then
   crGreen else crRed
else crBlack

should do it..but I've been wrong before
IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 24 Sep 2013 at 5:38am
The red is working, what should be green is black......
Be kind to those less fortunate.
IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 24 Sep 2013 at 6:05am
This is working:
 
if {OPPOR.ENDDAT_0} <= currentdate -30 and {OPPOR.ENDDAT_1} = date(1753,1,1) then
crRed
Else if {OPPOR.ENDDAT_0} >= currentdate -7 and {OPPOR.ENDDAT_1} = date(1753,1,1) then
    crGreen else
crBlack
Be kind to those less fortunate.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 26 Sep 2013 at 4:55am
silly question...is what should be black, green?

looking at the logic, the green will never be hit...because x - 7 is less than x - 30.

so what if we try:
local numbervar diff30 := currentdate - 30;
local numbervar diff7 := currentdate - 7;

if {field} <= diff30 and {field} > diff7 then
crRed
else
if {field} >= diff7 then
    crGreen
else
    crBlack


or some variation of this idea.

HTH
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