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!

Totals on Manual Running Total Variables

Status
Not open for further replies.

cabrera01

Technical User
Nov 24, 2008
15
0
0
I have a report that I wrote in crystal 10 in which I'm trying to get the total readmisson days for a patient. If the patient has multiple records, I need calculate the days difference between the Discharge and Admisson Date. The report is grouped by Dr# and Patient Record#. I can successfully calculate the readmission days using the 3 step Manual Running Totals method to get the totals of days for GF2. My problem is that I would like to know how many patients that were seen by DR# were readmitted with 7 and 30 Days (which will go in GF1).

I wrote a formula called (@7redays):
if (@Display)<=7 then 1 else 0

I tried to sum off this field, but was not able to. This is where I'm stuck. Any Suggestions?

I have a current admission date formula as:
(@testadm):
whileprintingrecords;
datevar Admit:={@admitn}

the previous discharge date formula is:
(@prevdisch):
whileprintingrecords;
datevar prevdisch:=PREVIOUS({@dischn})

(@admitn) = cdate(totext({BADPLPP.LPADT1},"00")+"/"+
totext({BADPLPP.LPADT2},"00")+"/"+
totext(2000+{BADPLPP.LPADT3},"0000"))

(@dischn) = cdate(totext({BSYRRVU.RVLDD1},"00")+"/"+
totext({BSYRRVU.RVLDD2},"00")+"/"+
totext(2000+{BSYRRVU.RVLDD3},"0000"))

I can get the number of days between days by using the formula (@redays):
if {@testADM}-{@prevDISCH}<0 then 0 else {@testADM}-{@prevDISCH}

3 Step Manual Running Totals:

//Reset in Detail DA section
whileprintingrecords;
global numbervar ReAdmittDays:=0;

//Increment in Detail DB Section
whileprintingrecords;
global numbervar ReAdmittDays:=ReAdmittDays + (@redays)

//Display In GF2 Section
whileprintingrecords;
global numbervar ReAdmittDays;
 
YOu can use a variable

(@7redays):
whileprintingrecords;

if (@Display)<=7 then global numbervar 7days:= 7days+1

Use a reset in your doctor group header
@reset
whileprintingrecords;

global numbervar 7days:= 0

Display in group footer
@display

whileprintingrecords;

global numbervar 7days;

Ian
 
If you want the summary at the Group #2 level, the reset formula must be in the Group Header #2, NOT in the detail_a section.

-LB
 
In which section would I put the increment formula?
 
If I place (@7days) in the details db section, it counts all the records. If I place the (@7days) in GF2, where the (@display) is, I get the correct number. Is that the way it is supposed to be?
 
You have unnecessary formulas which are making this hard to follow. If you are trying to count as 1 each time a patient is readmitted within 7 days, and then also summarize this at the doctor level, use these formulas:

//{@accum} to be placed in the detail section:
whileprintingrecords;
numbervar in7days;
if {table.patientID} = previous({table.patientID}) and
{@admitn}-previous({@dischn}) > 0 and
{@admitn}-previous({@dischn}) <= 7 then
in7days := in7days + 1;

In the Group #2 footer, to display the number of readmissions within 7 days, use:

//{@displaypt}:
whileprintingrecords;
numbervar in7days;
numbervar drin7days := drin7days + in7days;
in7days;

//{@displaydr} to be placed in the Group #1 footer:
whileprintingrecords;
drin7days;

//{@resetpt} to be placed in Group header #2:
whileprintingrecords;
numbervar in7days;
if not inrepeatedgroupheader then
in7days := 0;

//{@resetdr} to be placed in the Group header #1:

whileprintingrecords;
numbervar drin7days;
if not inrepeatedgroupheader then
drin7days := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top