Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: end of year for weekly report Post Reply Post New Topic
Author Message
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Topic: end of year for weekly report
     Posted: 22 Aug 2012 at 4:45pm
hello,

I created crystal report that has formula {date column} in yeartodate. This runs weekly with current yrs data.

But at the end of yr, say 1st Jan falls on wednesday and this report run next week, I wish to have not just data from 1st Jan but Monday(30th Dec), Tuesday(31st Dec). And After 1st week into new yr, I wish to keep formula as above. Will below formula work?
{date column} in YearToDate
or
If DatePart ("ww",{date column},crFirstfullweek) = 1
then {date column} in LastFullWeek

If not, how do I handle the 2nd condition


Edited by trac - 22 Aug 2012 at 4:45pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Aug 2012 at 3:50am
You don't need the IF statement - just use
{date column} in YearToDate or {date column} in LastFullWeek
 
If you're not on the first week in the year, the date will be in YearToDate AND LastFullWeek, so this won't include any "extra" dates except when you in the first week of the year.  Make sense?
 
-Dell
IP IP Logged
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Posted: 23 Aug 2012 at 4:53am
Dell,
 
inyour code you have OR condition.
{date column} in YearToDate or {date column} in LastFullWeek.
 
And in your explanation you mention about And condition.
YearToDate AND LastFullWeek
 
Could you please confirm ANd or OR condition?
 
Appreciate your help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2012 at 5:38am
use the OR in the select statement.
I beleive that Dell was explaining that a row might meet both conditions (this and that) and it would still be included but it should never result in more rows than you intended.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Aug 2012 at 5:40am
That's correct - the syntax in the command is OR, but the explanation of what's happening is that some dates will meet both conditions and, during the first week of the year, some dates will only meet the LastFullWeek condition.
 
-Dell
IP IP Logged
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Posted: 23 Aug 2012 at 4:42pm
duhhhhhh

I should I realized. Thanks for all your help
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