0

I'm displaying a page total in the page footer of my report by using three formulas:

@InitializeTotals (placed in the page header)

whileprintingrecords;
global currencyvar totalsssprem:=0;
global currencyvar totalhdmfprem:=0;
global currencyvar totalphilhealth:=0;
global currencyvar totalsalcal:=0;
global currencyvar totalhdmfloan:=0;
global currencyvar totalhousing:=0;
global currencyvar totallending:=0;
global currencyvar totalcashadv:=0;
global currencyvar totaldamages:=0;
global currencyvar totalcashbnd:=0;
global currencyvar totalfines:=0;
global currencyvar totallosttck:=0;
global currencyvar totalothers:=0;
global currencyvar totalasscntr:=0;
global currencyvar totalcndonation:=0;
global currencyvar totalnetpay:=0;

@IncrementTotals (placed in the details section)

whileprintingrecords;
global currencyvar totalsssprem;
global currencyvar totalhdmfprem;
global currencyvar totalphilhealth;
global currencyvar totalsalcal;
global currencyvar totalhdmfloan;
global currencyvar totalhousing;
global currencyvar totallending;
global currencyvar totalcashadv;
global currencyvar totaldamages;
global currencyvar totalcashbnd;
global currencyvar totalfines;
global currencyvar totallosttck;
global currencyvar totalothers;
global currencyvar totalasscntr;
global currencyvar totalcndonation;
global currencyvar totalnetpay;
totalsssprem:= totalsssprem + {deposit_summary.sss_prem};
totalhdmfprem:= totalhdmfprem + {deposit_summary.hdmf_prem};
totalphilhealth:= totalphilhealth + {deposit_summary.philhealth};
totalsalcal:= totalsalcal + {deposit_summary.sal_cal};
totalhdmfloan:= totalhdmfloan + {deposit_summary.hdmf_loan};
totalhousing:= totalhousing + {deposit_summary.housing};
totallending:= totallending + {deposit_summary.lending};
totalcashadv:= totalcashadv + {deposit_summary.cash_adv};
totaldamages:= totaldamages + {deposit_summary.damages};
totalcashbnd:= totalcashbnd + {deposit_summary.cash_bnd};
totalfines:= totalfines + {deposit_summary.fines};
totallosttck:= totallosttck + {deposit_summary.lost_tck};
totalothers:= totalothers + {deposit_summary.others};
totalasscntr:= totalasscntr + {deposit_summary.ass_cntr};
totalcndonation:= totalcndonation + {deposit_summary.cndonation};
totalnetpay:=totalnetpay + {@net_pay};

And a display formula for each variable in the page footer. They all look like this:

whileprintingrecords;
global currencyvar totalsssprem;
totalsssprem

This displays the correct total for the first variable (totalsssprem) just fine, but the rest are shown as 0.00 in the page footer. Any ideas?

Yves
  • 682
  • 1
  • 6
  • 15
  • Do you mean that it increments them just fine? What do your formulas for displaying the values look like? What you're doing is simple – why not just use running totals (or summary fields, for that matter)? – paulmelnikow May 11 '12 at 05:49
  • Ah, you're resetting on each page. If you add a grouping level which corresponds with your pages – it is based on some kind of group, isn't it? – you can use summaries or running totals, which would be a lot cleaner. – paulmelnikow May 11 '12 at 05:52
  • No groups, just a total per page, so I can't use running totals as far as I know. The other variables don't seem to be incrementing, except that one variable, and it's displaying just fine. Edited my question to include the display formula. – Yves May 11 '12 at 06:25

1 Answers1

2

The first thing that comes to mind is that one (or more) of your fields could be null which would cause the formula to crap out. Try lines like these in your increment formula and see if it helps at all:

if not(isnull({deposit_summary.sss_prem})) then totalsssprem:=totalsssprem+{deposit_summary.sss_prem};

Ryan
  • 7,212
  • 1
  • 17
  • 30