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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Feed today's date to a scheduled report parameter

Status
Not open for further replies.

SouthernRed

Technical User
Jan 27, 2004
10
Have a scheduled report with only one parameter. Want to feed it today's date whenever it is scheduled to run. Easiest way ?
 
The easiest is not to pass anything and not to use parameter at all. Instead, in the report selection expert use formula
{table.date_field)=currentdate
 
Thank you but what if I want to have the best of both worlds, Users during the day can use the report with date parameters to report on another day but when it is batched at night it will use currentdate. In the parameter default, can I use currentdate? Thank you
Crystal is 8.5
 
Currentdate is the parameter default if you don't create any default values.

-LB
 
We do this in our reports on my current project.

We use 2 paramaters, 1 for selecting the schedule type and 1 for the date.

The {?Schedule Type} parameter is a string that can only have 1 of 2 values, "Recurring" or "On Demand".
The {?Data Date} parameter is a date field that would default to any date you choose.

The logic is this: If the user selects "Recurring" then the Data Date parameter is ignored and the current date is used. If "On Demand" is selected, then the value in Data Date is passed to the database.

This logic is used in the Record Selection Formula like this:
Code:
{table.date_field} = 
switch
(
    {?Schedule Type} = "Recurring", CurrentDate,
    {?Schedule Type} = "On Demand", {?Data Date}
)
This works well for us. It accomplishes our need and also is efficient since this will get passed down to the database.

~Brian
 
What are you using to schedule the report? Some report schedulers (including my Visual CUT) provide special "constants" for specifying that when the report schedule runs, the date parameter should be set to today's date or yesterday's date, etc.

This indeed gives you the best of both worlds since during interactive use, the parameter behaves like a regular interactive parameter.

Bottom line: if you are using a report scheduler utility, check the user manual... :eek:)

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top