Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Display Date Range in Report Post Reply Post New Topic
Author Message
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Topic: Display Date Range in Report
     Posted: 27 Apr 2012 at 7:32am
I have a report that utilizes a date range parameter.  I want to display that date range at the top of my report.  I have the following formula, but it only displays one date? 


'Check Date Range: ' + '  ' + CSTR(Minimum({prhpost.chkdate})) + ' TO ' + CSTR(Maximum({prhpost.chkdate}))

If I put in 4/9/2012 to 4/22/2012 (payroll dates) in my date range it displays

4/13/2012 To 4/13/2012

Anyone have a clue?  4/13 isn't even one of the dates that I picked?  although it is in the range.

thanks for any help.

DDavid Justice
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 27 Apr 2012 at 8:01am
try formula
"Check Date Range: in "+
totext(minimum(date range parameter))+" to " +
totext(maximum(date range parameter))
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 27 Apr 2012 at 8:08am
I tried that and get the same thing.  I have figured out that  'prhpost.chkdate' are actual check dates, which means that only every other Friday dates are in the table.  If I pull 4/9 - 4/22 I will only get 4/13 becaue that is the only date in the table within that range. 

So, If I have the user pull by check date ranges (4/13-4/27, the 2 Fridays in the payroll period)  it will return in my display 4/13 To 4/27.  So, now I'm thinking I want to do something like:

'Check Date Range: ' + '  ' + CSTR(Minimum({prhpost.chkdate}-5)) + ' TO ' + CSTR(Maximum({prhpost.chkdate}-5))

this would give me the actual date for the pay period range (4/9 - 4/22), but this isn't working.  I can't seem to find the correct formula to subtract days from the check date?

DDavid Justice
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 27 Apr 2012 at 8:21am
maybe

'Check Date Range: ' + '  ' + CSTR(Minimum({prhpost.chkdate}-5)) + ' to ' +
CSTR(Maximum({prhpost.chkdate}+2))
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 27 Apr 2012 at 8:37am
Nope, I've tried all the variations...nothing works?  
DDavid Justice
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 27 Apr 2012 at 8:40am
can you give me an example of what it looks like and
what you want it to look like.
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 27 Apr 2012 at 8:47am
On the report the field @Check Date Range is the formula:

'Check Date Range: ' + '  ' + CSTR(Minimum({prhpost.chkdate})) + ' to ' +
CSTR(Maximum({prhpost.chkdate}))

In the date range parameter you put in a beginning and end date.  The only dates in the table prhpost.chkdate are pay check dates (every other Friday). So, now, if I pull 4/13 - 4/27 the report shows

Check Date Range: 4/13/2012 To 4/27/2012

I want to, in the formula, subtract 5 days from the beginning date and end date to show the actual pay period, which would be 4/9 - 4/22


DDavid Justice
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 27 Apr 2012 at 10:01am
"Check Date Range: " + " " + CSTR(dateadd("d",-5,Minimum({prhpost.chkdate}))) + " to" +
CSTR(dateadd("d",-5,Maximum({prhpost.chkdate})))

not sure if this will work haven't tested it
you might need to create Minimum({prhpost.chkdate}) as a separate formula
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 03 May 2012 at 7:42am
That worked perfectly.  Thanks!!
DDavid Justice
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