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

Formula not summarizing data correctly

Status
Not open for further replies.

lndoan

IS-IT--Management
Jun 30, 2005
28
US
I have a formula in the group header (trip.trip_date) to calculate train with schedule type of extra daily.

whileprintingrecords;
numbervar dailyextra;

if {?TripDate} = {?TripDate} and ({SCHED_MAIN.SCHTYP_SCHEDTYPE_NO} = "EXTRA") then
dailyextra := dailyextra + 1
else
0

When it calculates, i validate it against the data on the system and the calculation is incorrect.

The display formula i use in the report footer is:

whileprintingrecords,
numbervar dailyextra;

Any suggestions would greatly appreciated.
 
Two things:

In the first line you have set one parameter equal to itself, so that will always be true. Secondly, you should verify that {SCHED_MAIN.SCHTYP_SCHEDTYPE_NO} does in fact result in "EXTRA". Check the data in the detail section. Note that if there can be extra spaces or variable cases, you should use:

ucase(trim({SCHED_MAIN.SCHTYP_SCHEDTYPE_NO})) = "EXTRA"

Also, you don't really need a variable for this, although it doesn't hurt.

-LB
 
Thanks Lbass,

The data in the system has 'EXTRA' defined as a schedule type for sure. I changed the formula to read:

if ucase(trim({SCHED_MAIN.SCHTYP_SCHEDTYPE_NO})) = "EXTRA" then
dailyextra := 1
else
0

for today's date and the calculation is still incorrect, for some reason, it's not picking up all the 'EXTRA' in the system for today. Today's 'EXTRA' should be a total of 2, not 1
 
Try:

if ucase(trim({SCHED_MAIN.SCHTYP_SCHEDTYPE_NO})) = "EXTRA" then 1

Right click on this in the detail section and insert a summary (Sum, not count)

-LB

 
I can't sum a formula (@dailyextra) in the details using the above calculations.
 
If you created the formula exactly as I showed and placed it in the details section, you can right click on it and insert a summary--so I don't know what you mean.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top