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

Sum and Total of Variable 1

Status
Not open for further replies.

LT2

MIS
May 24, 2006
232
US
Hello,

Using CRXI w/SQL Svr.

I have a report grouped by Client.

Group Header contains:
@UntimelyReset //Reset group untimely count
whileprintingrecords;
numbervar cnt;
IF not inrepeatedgroupheader
THEN cnt:=0;

@UntimelyReset2 //Reset group untimely
whileprintingrecords;
numbervar untimely;
IF not inrepeatedgroupheader
THEN untimely:=0;

Details contains:
@Untimely //Count # of untimely instances
whileprintingrecords;
numbervar cnt;
IF {command.DaysToAdmit} > 14
THEN cnt:= cnt+1;

Group Footer contains:
Summary of Distinct Appointments
Summary of Distinct Admissions
@UntimelySum //Summarizes # of Untimely
whileprintingrecords;
numbervar cnt;
IF cnt = 0
THEN cnt:=1
ELSE cnt:=cnt+1;

Report Footer contains: //Untimely Total
Summary of Distinct Clients
Summary of Distinct Appointments
Summary of Distinct Admits
@UntimelyTotal
whileprintingrecords;
numbervar untimely;
untimely

The sum by group isn't working correctly and I get 0 results for the total in the footer.

What am I doing wrong?
 
Can't tell what you are trying to do here. Please explain what each variable is intended to do.

-LB
 
Hi LB,

My report displays:

Appointment, RecordDate, DateOfFirstRequest, Agency, AdmitDate, DaysToAdmit, @LackOfCapacity, LevelOfCare

@LackOfCapacity
IF ({Command.DaysToAdmit}) >14
THEN 'N'
ELSE 'P'

The report is grouped by Client with a Distinct Count of Appointments, Distinct Count of Admits and an attempt to get count of Untimely Instances using @UntimelySum in the group footer.

Purpose of the report is to show and count and total the instances where DaysToAdmit are greater than 14 days.

Variables are intended to:

@UntimelyReset //Reset group untimely count
@UntimelyReset2 //Reset group untimely
@Untimely //Count # of untimely instances
@UntimelySum //Summarizes # of Untimely
@UntimelyTotal //Totals number of Untimely Instances for whole report.

I'm not sure they are correct.
 
I don't think you need variables. Try creating a formula:

IF {command.DaysToAdmit} > 14 then 1

Then right click on this formula in the detail section and insert a sum (not a count) at the group and report levels.

-LB
 
Thanks LB, I think this works just fine.

Forgive my ignorance, how do you know when it's necessary to use variables?

LT
 
Usually you should avoid them unless you are trying to summarize a value that is already a summary. There are other reasons, but that is maybe the most common.

-LB
 
Great, thanks! I do appreciate your time and sharing your knowledge.

-LT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top