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!

previous days

Status
Not open for further replies.

jenniemd

Programmer
Feb 25, 2002
4
US
I was surprised to find that my choices do not include previous business day as a date selection--also i have a client that needs a report that is scheduled on Tuesday which needs data from Friday through Monday...and on Friday from Wednesday through Thursday....please help with these date selections...
 
I assume you are talking about parameter choices when executing a report? If you make it a date field, the user can select ANY date.

Unfortunately, crystal does not have a "last work day" as a valid default value of a data parameter - you have to go pick a date fo reh report.

The only way I beleive this could be done is with VB and the crystal report designer component. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
I have version 8.5....this forces me to select the date everytime...i want to automate the report......no formula that i can use?
 
Do you want to automatically have the report run for the last workday, or do you to be prompted for a date?

If you want the last workday, you can get there, but that rules out a prompt for the date totally.

DayofWeek() returns an intger of 1 (sunday) thru 7 (Saturday). So, to get the last workday:

if Dayofweek(CurrentDate)=2 then {Table.DateField} in Dateadd("d",-3,CurrentDate) else
if Dayofweek(CurrentDate)=1 then {Table.DateField} in Dateadd("d",-2,CurrentDate) else
{Table.DateField} in Dateadd("d",-1,CurrentDate)

this will get every from 3 days ago if run on a Monday, from 2 days ago if run on a Sunday, ar from yesterday on all other days.

The downside is that you cannot be prompted for a date, but you could easily take the same repot and convert to a similar report with date prompts.

Let me know if you have any questions.
Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top