Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating in a scan...endscan
Message
From
02/10/2006 03:13:25
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01158457
Message ID:
01158486
Views:
21
>:( after i asked i found my mistake and solved my problem ,
>if any good suggest will be very appreciated
>
>
>Local lnRemainder
>	m.Remainder = 0
>	Go Top
>	Scan
>		Replace CrsResult1.Remainder With m.lnRemainder + CrsResult1.debit - CrsResult1.credit In CrsResult1
>		m.lnRemainder = CrsResult1.Remainder
>	Endscan
>
Hi Soykan,

Our accountants calls this 'running balance' and is very common
calculation in accounting statements/balances of all sorts.

If Scan/Endscan is already used to prepare report info
then I differ from Hilmar here, and prefer it precalculated in that very cursor rather then using report variables.

However, if data are previosely extracted via some SQL procedure,
and all you do here is additionaly calculating that running balance,
then I agree with Hilmar, because report variables spares you of need
(time) for that additional loop on basically the same data.

BTW Wldn't it be simplier like this ?
Local lnRemainder
m.lnRemainder = 0.00
Go Top
Scan
 lnRemainder = lnRemainder + crsResult1.debit - crsResult1.credit
 Replace CrsResult1.Remainder With lnRemainder
Endscan
2c
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform