Thursday, August 14, 2008

Crystal Report - Auto Schedule by Weekly or Monthly

Human nowadays is getting lazier and lazier. Most of the time we will let "Robot" to do our daily jobs. In crystal report, it is possible to schedule daily, weekly, monthly, or quarterly report based on the parameter with auto scheduling using Job Scheduling function provided by Microsoft SQL Server.

Create a schedulebyparameter to accept values Weekly or Monthly,
Create a crystal report formula

Filter From Date (Last 7 Days)

IF schedulebyparameter = "Weekly" THEN
Datadate - 7
ELSE IF schedulebyparameter = "Monthly" THEN
Date(DateAdd ("m", -1, Datadate - day(Datadate)+1))



Filter To Date (Yesterday)

IF schedulebyparameter = "Weekly" THEN
DataDate - 1
ELSE IF schedulebyparameter = "Monthly" THEN
Datadate - day(Datadate)

No comments: