Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to put running balance in local view?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00212879
Message ID:
00213704
Vues:
37
>So lets get back to the basics here. You need a grid to display data from some sort of "ledger" where the starting "balance" is dynamic. You want to update the balance's VALUE per transaction in the ledger system.
>
>Are you going to allow this grid system to accept new transactions, such as credits, adjustments, or other?

Yes the form accepts new debit and credit items. I requery() the view after each update.

>Please show me how >> I know that with a sufficent number of TABLEREVERT calls I can make it work, but that is anything but simple.<< this is necessary?
>

Here is the code that produces the running balance. Almost identical to your code:

select v_AITEMS
requery()

select sum(yAmount) from v_AITEMS into array laBalance
if _tally>0
this.yDetailSum = laBalance[1]
lyBalance = 0
scan
lyBalance = lyBalance + round(yAmount,2)
replace yBalance with lyBalance
endscan
else
this.yDetailSum = 0
endif

If I execute this code twice, I get the message "Do you wish to save changes?" just before the requery. If I close the form I get the same message. Etc.

BTW, the query insures that the balance is zero before the first retrieved item.

Peter
Peter Robinson ** Rodes Design ** Virginia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform