Hello again.
Yes, still the same report as in this question and this other question. Yes, I know, I'm a CR noob :-) Anyway, I've browsed Google attentively and lots of tutorials about how to use shared variables popped up, yet I seem unable to grasp its workings because I can't achieve what I need.
These are my formulas: (ActiveAttSaldo, created in positive assets subreport) whileprintingrecords; global numbervar att_saldo; att_saldo := Sum ({@ImportoEuroConto}, {SP_EstrattoConto.TipoConto})
(PassSaldo, created in negative assets subreport) whileprintingrecords; global numbervar pass_saldo := 0; pass_saldo := Sum ({@ImportoEuroConto}, {SP_EstrattoConto.TipoConto})
(UtileSaldo, created in main report) whileprintingrecords; shared numbervar ut2_saldo; ut2_saldo := {@AttSaldoShared}-{@PassSaldoShared};
if ut2_saldo > 0 then 'UTILE: '+ToText(ut2_saldo) else if ut2_saldo = 0 then 'Pareggio' else 'PERDITA: '+ToText(ut2_saldo)
(PassSaldoShared, created in main report) whileprintingrecords; global numbervar pass_saldo; pass_saldo;
(AttSaldoShared, created in main report) whileprintingrecords; global numbervar att_saldo; att_saldo;
The idea is to have a "final balance" but the variables are always 0, so I always see "Pareggio" instead of the correct values. All the formulas are correctly placed:
- ActiveAttSaldo is placed in group footer 1(active assets subrep) - grouped by "TipoConto"
- PassSaldo is placed in group footer 1(passive assets subrep) - grouped by TypoConto
- UtileSaldo, AttSaldoShared and PassSaldoShared are all declared in the same section, which is a group footer 1b(in group footer 1a both subreports are present) grouped by CodiceSocieta(CompanyCode, in English).
To my knowledge, this is supposed to be the correct way to do things(but I may be wrong, that is... :D) and I can't pinpoint the problem. May you please help me?
Best Regards,
Andrew