Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date range issue Post Reply Post New Topic
Author Message
Flashh880
Newbie
Newbie
Avatar

Joined: 14 Apr 2014
Location: Canada
Online Status: Offline
Posts: 5
Quote Flashh880 Replybullet Topic: Date range issue
     Posted: 17 Apr 2014 at 3:56am
Hi everyone,

     I'm totally new on crystal report, started 2 weeks ago trying to build reports, so thanks for your patience :)

     I'm working with Crystal 2008 V12, and reports are made from Sage Accpac sql database.

     I've been setting up a an automatic reporting with Report Scheduler Pro. My formula si very simple for what it does, it reports me all the new orders in the last 7 days, and it works well.


pwformatdate({VMDH.DTENTERED}) in Last7Days

     What I now want to do, and searched for hours before requesting your help, is to find the formula to generate the list of new orders in the week before, and the other one before, going back one month.

Ex : Last 8days to 14 days
     Last 15 days to 21 days
     Last 22 days to 28 days.

Thanks in advance for your precious help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Apr 2014 at 4:03am
datediff('d',{VMDH.DTENTERED},currentdate) in 8 to 14
IP IP Logged
Flashh880
Newbie
Newbie
Avatar

Joined: 14 Apr 2014
Location: Canada
Online Status: Offline
Posts: 5
Quote Flashh880 Replybullet Posted: 17 Apr 2014 at 4:23am
Many many thanks DBlank for your fast and effective answer! You can't imagine how it helps me :)

Can I push my luck to get a formula that would report me the exact same week of last year?

Thanks again!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Apr 2014 at 4:41am
define what you mean by same week please. The exact same dates less one year or the same week as in week 15?
IP IP Logged
Flashh880
Newbie
Newbie
Avatar

Joined: 14 Apr 2014
Location: Canada
Online Status: Offline
Posts: 5
Quote Flashh880 Replybullet Posted: 17 Apr 2014 at 4:42am
Would be exact same week as in week 15 :)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Apr 2014 at 4:54am
Actual dates would be
I think you might really want the dates since that is how you are doing this years so that would be
 
datediff('d',{VMDH.DTENTERED},dateadd('yyyy',-1,currentdate)) in 8 to 14
 
date part of week using 8 days ago I think would be:
datediff('w',date(1900,1,1),{VMDH.DTENTERED})=datediff('w',date(1900,1,1),dateadd('yyyy',-1,dateadd('d',-8,currentdate)))
 
 
IP IP Logged
Flashh880
Newbie
Newbie
Avatar

Joined: 14 Apr 2014
Location: Canada
Online Status: Offline
Posts: 5
Quote Flashh880 Replybullet Posted: 17 Apr 2014 at 8:41am
You've got it right on!

Many thanks for your help, really appreciated! :)
IP IP Logged
Flashh880
Newbie
Newbie
Avatar

Joined: 14 Apr 2014
Location: Canada
Online Status: Offline
Posts: 5
Quote Flashh880 Replybullet Posted: 18 Apr 2014 at 5:50am
Hi again,

     I try to setup this command in a formula, in a subreport, and try to call it from the main report through a parameter, and it doesn't work at all.

datediff('d',{VMDH.DTENTERED},dateadd('yyyy',-1,currentdate)) in 8 to 14

     When I run only the sub report, it's ok.

     Any idea where could be the bug? :)

PS: believe, I search at least 3 hours before posting a request here :)

Edited by Flashh880 - 18 Apr 2014 at 5:52am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Apr 2014 at 7:09am

What are you trying to accomplish?

Passing the same date range from main to sub report?
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