Friday, April 9, 2010

Crystal Reports Monthly Reports

Monthly Reports:


Monthly reports are the reports which are scheduled in the server to run monthly once and pulls the previous month data's. In crystal reports server, we can schedule the reports, when to run (i mean the day of the month), but there is no option to specify on which days(from and to dates) it has to show the data.

ORACLE Query:
To get the date of the last month's first day.
 TO_DATE( (ADD_MONTHS (TRUNC (SYSDATE,'MM'),-1) ) ) )
To get the date of the last month's last day.
 TO_DATE( (ADD_MONTHS (TRUNC (SYSDATE,'MM'),0)-1 ) ) )

Crystal reports Formula for last month first date and last date:
Formula to get the date of the last month's first day.
DateAdd('m',-1,CurrentDate-day(CurrentDate)+1)-1+1
Formula to get the date of the last month's last day.
DateAdd('m',0,CurrentDate-day(CurrentDate)+1)-1

No comments:

Post a Comment