Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula for changing the Monthly Report To Daily Post Reply Post New Topic
Author Message
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Topic: Formula for changing the Monthly Report To Daily
     Posted: 23 Sep 2009 at 2:12pm

Hello Folks,

                    I have this report which is a Monthly report and returns data  for the previous Month. Now the requirement is that we need to replicate the report so that it returns Data on a Daily purpose inclusive from the first Day of the month to the previous Day. Can anyone throw some light on this by providing the formula which i can use it in the Record Selection Formulas.
 
 
Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Sep 2009 at 6:15am
Boy, that's a tough one, as I have no idea how your filter is currently working or what your data looks like.
 
As a guess, you have a date field that you were filter against, and you were looking for the month to be 1 less than the month is now.  I would use the same date field, but I would change the selection criteria to something like:
 
if {table.datefield} IN cdate(year(currentDate), month(currentDate), 1) to cdate(year(currentDate), month(currentDate), day(currentDate)-1) then
//keep
else
//don't keep
 
HTH
IP IP Logged
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Posted: 25 Sep 2009 at 9:00am

Hey lockwelle thanks for getting bak and i bet it is for you. Here i would provide more information about what is the Record Selection Formula that am using previously.

Month ({RECOVERY.RECOVERY_DATE}) = {@ReportMonth} and
Year ({RECOVERY.RECOVERY_DATE}) = {@ReportYear}
 
where @ReportMonth has a formula under it which returns data for previous month.

{@ReportMonth=If Month(CurrentDate) = 1 then
    12
else
Month(CurrentDate)-1
and {@ReportYear} =if Month(CurrentDate)= 1 and Day(CurrentDate) = 1 then
    Year(CurrentDate) - 1
else
    Year(CurrentDate)
 
 
 
I havent tried ur Formula but it looks ok except the 'keep and no keep' part.
 my requirement is to get the Current month  data for each and every Date from the 1st of the current month  upTo Yesterday but not inclusive of Todays Data.
 
 
Thanks man
 
 
 
 
 
 
 


Edited by Nav522 - 25 Sep 2009 at 9:02am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Sep 2009 at 10:47am
the keep/no keep is just whatever code.  to match what you have:
 
{table.datefield} IN cdate(year(currentDate), month(currentDate), 1) to cdate(year(currentDate), month(currentDate), day(currentDate)-1)
 
should do it.
 
 
 
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