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

I have a column that pulls a patien

Status
Not open for further replies.

BettyJ

Programmer
Jul 25, 2012
269
US
I have a column that pulls a patient's latest office visit date which is based on a formula evaluated at runtime based on a Date Range parameter given. For eg.
?StartDateFrom (for eg. 2012-8-1)
?StartDateTo (for eg. 2012-8-31)
LastOfficeVisit pulls the last office visit date the patient had within the above date range.

The report needs to pull the first 100 patients who had their office visits between this date range sorted in descending order, as given below:
This is the format of the report
Age,LatestBPDate, LatestBP are all formula and all these are placed in the Group Footer Section (group-PatientName)

DOS Patient Sex Age LatestBPDate LatestBP
1. 8/31/2012 Pt_GGG ... ... ... ...
2. 8/31/2012 Pt_AAA ... ... ... ...
3. 8/30/2012 Pt_XXX ... ... ... ...
...
...
99.
100. 8/1/2012 Pt_YYY

Can anyone offer help on how to do this?
Thanks in advance for any help/suggestions.
Betty
 
How do you define "the first 100 patients who had their office visits between this date range"? chronologically? I ask because in your example, Number 1, PT_GGG, would be one of the last correct?


_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
oh in descending order .. I got it ... my mistake...

But I am still confused about your results.

try sorting by date descending then suppress using
recordnumber > 100

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Hi CoSpringsGuy.
Thank you for your response.
No, I want it in descening chronologically order. The report should be the way shown in my previous post. Patients with DOS 8/31/12 should be listed first.
Betty
 
Hi CoSpringsGuy,
I cannot sort it on date since it is a column based on a formula which is evaluated at runtime. (I don't see that formula name in the sorting field list).
Any ideas/suggestions?
Thank you.

Betty
 
Well I didnt pay very good attention at all to your post did i? Sorry about that .. please show your formula for that date



_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
WhilePrintingRecords;
dateVar last_off_visit_date:=cdate("1901,01,01");
stringVar physician:="";
if {@ConvertDate}>last_off_visit_date
then
(last_off_visit_date:={@ConvertDate};
physician:=TOTEXT({DOCUMENT.USRID});
);
last_off_visit_date;

DOCUMENT.CLINICALDATE is 16-digit.The first ten digits (counting from left to right) are a time/date stamp in an encoded format representing the number of seconds since January 1, 1960

@ConvertDate
NumberVar ID := {DOCUMENT.CLINICALDATE};
NumberVar Sec := Truncate(ID / 1000000);
NumberVar Days := Truncate(Sec / 3600 / 24);
Date(DateTime(Date (1960,01,01 ) + Days, Time(0,0,0) + Sec));
 
Remove the "whileprintingrecords" and then you can sort descending on your date formula.

-LB
 
Since it is placed in the group footer of PatientName, I cannot sort it on the calculated column. Is there any other way?
 
Place the following formula in the detail section and insert a maximum on it at the patient group level.

dateVar last_off_visit_date:=cdate("1901,01,01");
stringVar physician:="";
if {@ConvertDate}>last_off_visit_date
then
(last_off_visit_date:={@ConvertDate};
physician:=TOTEXT({DOCUMENT.USRID});
);
last_off_visit_date;

Then go to report->group sort->select maximum of your formula as the sort field, descending. You can choose top100, too. and you won't have to suppress anything.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top