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

Total Calculated field 1

Status
Not open for further replies.

RemJamie

IS-IT--Management
Jan 21, 2005
22
CA
I have a report for pay slips that I have to remove some paycode and add them to a different paycode to simplify the look of the report and cut down on duplicate information.
I have the following formula to do this;

if {CPY30161.PIncomeCode}="ST DIS" then
({CPY30161.PLineTotal}+Sum ({@STDIS2}))*-1 else
if {CPY30161.PIncomeCode}="STDIS2" then
0.00 else
if {CPY30161.PIncomeCode}="LT DIS" then
({CPY30161.PLineTotal}+Sum ({@LTDIS2}))*-1 else
if {CPY30161.PIncomeCode}="LTDIS2" then
0.00 else
if {CPY30161.PPayrollCodeType}=3 then {CPY30161.PLineTotal}*(-1)
else {CPY30161.PLineTotal}

This all works fine on the report, the problem is that I need a total of this field, which works except that it does not add the "+Sum ({@LTDIS2})" part of the code to the total.

I am at a complete loss as to why it totals everything except that one part of the formula?

Can someone please point me in the right direction?
 
I don't see anything in the formula above that would cause this problem. To trouble shoot this try placing {@LTDIS2} on the report and summing it to be sure in contains the values you are expecting. I am thinking the above formula may be working correctly and your problem is elsewhere in the report.
MrBill
 
I added a sum of those fields on the report and they are displaying the expected values.

Is it possible that it is calculating the total of the calculated filed before it is doing the calculation?

I have the sum for the LTDIS2 field in the report footer, if I move it I no longer get the correct values.

Any ideas?
 
I don't know what your report structure is, but to summarize a formula that already contains a summary, you would need to use a variable. Create two formulas:

//{@accum} to be placed in the same section as your formula:
whileprintingrecords;
numbervar sumformula := sumformula + {@myformula};

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar sumformula;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top