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

Adding Date Condition To A Crystal Report.

Status
Not open for further replies.

dapoole

Programmer
Dec 22, 2004
16
0
0
GB
Hi Crystal Guru

Sorry but I am a newbie to Crystal 9 and need a bit of help. The answer is probably dead easy but I would appreciate your advice nonetheless.

Okay I have access to my database and can select columns from the table and place into the report in one horizontal line. Now if I run the report the it lists every single row from that table. However what I need to do is apply a date restriction so that it only returns data specified between a date range.

For example: I have an employee table called emp with 5 employees (4 of which joined last month and 1 joined this week) and select the report to return their first and last names. Now when I run the report I get all 5 entries, however I want the report to only return the employees who joined in the last week, i.e. the 1 employee.

How do I set this up?

Cheers
David
 
Go to the Report Menu, Select Expert, <New> tab, select your date field, and "is greater than or equal to" from the drop down menu, and add your value.

You will probably find additional information, if you require background reading in your helpfile under date parameter.

Naith
 
Or you could try Report>Selection Formulas>Record and enter {Join.date} >= currentdate-6. That's for the last seven days: for a calendar week try Week({Join.date}) = Week(currentdate).

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Correction, Week({Join.date}) = Week(currentdate) and Year({Join.date}) = Year(currentdate). Otherwise you'll get the same week last year.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Week({Join.date}) = Week(currentdate) would not work if the report was run at any time other than the last day of the week.

I think {Join.Date} in Last7Days, or {Join.Date} in LastFullWeek would be more accurate.

Naith
 
Hi Gurus and thanks for the tips. I will try them out this week and hopefully not need any more help. Cheers
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top