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!

Finding "firstimers" 1

Status
Not open for further replies.

whimple

Programmer
Mar 31, 2002
7
0
0
US
I have one table which has a patient's name, and another table which contains a record from each time a patient visited our clinic. Each visit record includes the date. The tables are joined via an ID number - the patient table is the "one", and the visit table is the "many". I need to write a report that will display only the patient names of those who have visited for the first time since a specified date (the specified date to be determined by a parameter).
Any ideas on the easiest way to do this?
 
"I need to write a report that will display only the patient names of those who have visited for the first time since a specified date (the specified date to be determined by a parameter)."

I find this statement confusing....do you mean that you want to identify patients that have not visited since a specified date. (ie. they may have visited 100 times before but not since)
 
To get the correct data into your report you have to select on all the records in your joined tables.

Group your data by Patient ID and calculate the minumum visit date for each patient. This is the first time they visit.

Then use a group Selection formula of
Minimum({table.visitdate},{table.PatientID}) > {?SelDate}

This is how I'd do in a pure CR solution. If there is a lot of records, you might need a SQL solution with a view in the DB.
Editor and Publisher of Crystal Clear
 
chelseatech - thank you for your answer - most helpful!

Ngolem - let me clarify - I am aiming for a list of new patients (patients that are visiting the clinic for the first time). The date parameter would allow me to determine the time period I am selecting these new patients from - say, from now to one week ago.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top