Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Datepart issue Post Reply Post New Topic
Author Message
jeffwest1
Newbie
Newbie
Avatar

Joined: 25 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote jeffwest1 Replybullet Topic: Datepart issue
    Posted: 05 Feb 2009 at 12:48am
I am trying to determine how old something is, using this formula
 
if datepart("d",{SITUATIO.Start Date}) >= (datepart("d",CurrentDate))-0
and datepart("d",{SITUATIO.Start Date}) <= (datepart("d",CurrentDate))-89
then "<3 months" else
if datepart("d",{SITUATIO.Start Date}) >= (datepart("d",CurrentDate))-90
and datepart("d",{SITUATIO.Start Date}) <= (datepart("d",CurrentDate))-179
then "3 - 6 months" else
if datepart("d",{SITUATIO.Start Date}) >= (datepart("d",CurrentDate))-180
and datepart("d",{SITUATIO.Start Date}) <= (datepart("d",CurrentDate))-364
then "6 - 12 months" else
if datepart("d",{SITUATIO.Start Date}) >= (datepart("d",CurrentDate))-365
then "> 1 Year"
 
Only problem is, despite having dates that are only a few weeks/months old, it only seems to return the last value.
 
Anyone help with this please, it really is annoying me.
C-3PO: Excuse me sir, but might I inquire as to what's going on?
Han Solo: Why not?
C-3PO: Impossible man.
IP IP Logged
jeffwest1
Newbie
Newbie
Avatar

Joined: 25 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote jeffwest1 Replybullet Posted: 05 Feb 2009 at 1:58am
Solved, had the <= & >= the wrong way round
C-3PO: Excuse me sir, but might I inquire as to what's going on?
Han Solo: Why not?
C-3PO: Impossible man.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.