Crystal Reports Return Record for Most Recent Date

I have a Crystal report that includes fields for patient ID (ss_client_data_set.PATID), date of admission (ss_client_data_set.admission_date) and date of birth (ss_client_data_set.date_of_birth).  The data is grouped by PATID, and I want the report to return (not simply display) only the record for the most recent admission.
bkj1954Asked:
Who is Participating?
 
shivkasiCommented:
1. After PATID Group,  
    Group on  {additional field } and then
Group by {ss_client_data_set.admission_date} and DESCENDING order and place all your details on group HEADER of {ss_client_data_set.admission_date}

and then supress Goup1 and 2
===========

that's the easies way..insted of group you can also use sort   for{ss_client_data_set.admission_date}  

=========
Normal if you r filtering out true or false,then above (as specified in the first comment) would give the right result set.

for addtional info - EXAMPLE :
1.this is the max date for addtional field when it is true :
Group on PATID :
If {additional field } = true
then max({{ss_client_data_set.admission_date}  },{PATID})

this gives the max dates for TRUE on pat id group level... and you can make similar kinda formulas to acomplish your tasks.
0
 
shivkasiCommented:
1. After PATID Group,  
Group by {ss_client_data_set.admission_date} and DESCENDING order and place all your details on group HEADER of {ss_client_data_set.admission_date}

or
Group by {ss_client_data_set.admission_date} and ASCENDING order and place all your details on group FOOTER of {ss_client_data_set.admission_date}
0
 
bkj1954Author Commented:
Thanks for your quick response; what you suggested did work for displaying the most recent record. Now, let me complicate this a little.  I have an additional field in this table with a True or False value, which for any given PATID may change from admission to admission.  if I use the record selection expert to return only "true" values, the result is the last admission for which the marker was true, but not necessarily the actual last admission date.  Is there another formula or command that will enable me to continue to filter or query other fields based only on the records from the last admission?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.