Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrementing Date Parameters in CE Scheduled Report 2

Status
Not open for further replies.

mandarp

Technical User
May 8, 2003
2
IN
Hi,

Any idea how CE increments the date parameter for a given report, if its scheduleds on a recurring basis? :)
 
It should schedule exactly as you ask it to, daily, weekly, etc.

If you're trying to get a report to run daily, then don't use a parameter for date comparison, just code the record selection formula with something like:

{table.date} >= currentdate-7 // Last week

-k
 
I cant do this, as the same report is used for daily, weekly as well as monthly reporting.
 
I have a solution for this, as I'm in the middle of doing it right now, it's not ideal, but it works.

Create a string parameter called {?Frequency}

In you record selection formula put something like :

(if {?Frequency} = "Daily" then
{PROC_DATE} = CurrentDate-1 else true) and
(if {?Frequency} = "Weekly" then
{PROC_DATE} in CurrentDate-7 to CurrentDate else True) and
(if {?Frequency} = "Monthly" then
{PROC_DATE} in Date(Year(DateAdd("m",-1,CurrentDate)),
Month(DateAdd("m",-1,CurrentDate)),01) to Date(Year(CurrentDate),Month(CurrentDate),01) else True)

Then, when you schedule in Crystal Enterprise, set the parameter to either Daily, Weekly or Monthly.

Let me know how you get on.

Reebo
Scotland (Sunny with a Smile)
 
You build the logic into the report. On the CE side the report is scheduled to run at the end of the business day and you want to view the report the next day.

Add the logic into the record selection as:

{table.date_field} in currentdate

Now publish the report in CE and schedule it. The report captures the data based on the date field.

Hope this helps.
 
We do this for almost every report using code similar to the following:

//Switch statement allows for both 'On Demand' and 'Recurring' scheduled reports
//Switch used to derive the data cycle

{v_view.date} In
Switch
(
{?Schedule Type} = 'On Demand',{?From Data Date} To {?Through Data Date},
{?Schedule Type} = 'Recurring' And {?Date Period} = 'Weekly',LastFullWeek,
{?Schedule Type} = 'Recurring' And {?Date Period} = 'Monthly',LastFullMonth,
{?Schedule Type} = 'Recurring' And {?Date Period} = 'Annual',
Date((Year(CurrentDate) - 1),1,1) to Date((Year(CurrentDate) - 1),12,31)
)

Just set the appropriate parameters and create the recurring schedules, changing the parameters for each respective schedule. This selection criteria will also enable you to efficiently run the report for on-demand date periods (if you wanted to re-run a weekly report for a date period 3-weeks past, for example) without having to modify the report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top