I have a date range parameter. I need to find the last office visit date within the date range. Then based on the last office visit date, observation values (BP, A1C, Eye Exam,etc) on or before that office visit date needs to be pulled. for eg:
Office Visit Date BP Date HgbA1C Date Eye Exam Date
12/1/2012 12/1/2012 12/1/2012 12/1/2012
11/16/2012 11/16/2012 6/1/2012 6/1/2012
10/3/2012 10/3/2012
6/1/2012 6/1/2012
If parameter Date From is 10/1/2012 and Date To is 10/31/2012
then the report should pull
Office Visit Date BP Date HgbA1C Date Eye Exam Date
10/3/2012 10/3/2012 6/1/2012 6/1/2012
How can this be done? Can anyone please advise. Thanks in advance.
check DOCUMENT.CLINICALDATE and RPTOBS.OBSDATE.
jj,
Thank you. I will get back to you later. Got to modify another report right now (very urgent).
I had done this report originally using the LASTLABS table. The report pulled all the latest observation values of the patients. But now, it has to be redone in such a way that when a date range is given, the latest observation values within that date range (and within 1 yr from the latest office visit within the date range) should be pulled. I am using the fields that JJordet suggested. But I need an overall idea on how to do this. Do I need to use subreport? Can JJ/anyone help with this? Thanks.
@ClinicalDate is the formula for converting the clinical date to an actual date.
create formulas for each obs term to display...i.e. if RPTOBS.HDID = HDID of desired obs term then ToText(RPTOBS.OBSDATE) else ""
@ClinicalDate >= begin date
and @ClinicalDate <= end date
and RPTOBS.OBSDATE <= @ClinicalDate
group by DOCUMENT.SDID...suppress group header
detail line should show each obs term formula...suppressed
group footer should show @ClinicalDate and Maximum of each obs term formula