Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to put running balance in local view?
Message
De
28/04/1999 14:55:38
 
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:
00213127
Vues:
39
The problem with that, Nick, is that you might not always need to refresh the view when Refreshing the form and your app will slow down a lot. I guess in VFP6 you could add _Assign code to the Control.Values that would fire a requery as needed.

>I usually do not setup the view for it - I put the code like this into textbox.Refresh()
>
>LOCAL array laTotal[1]
>laTotal[1] = 0
>SELECT SUM(amount) FROM myView as Total
>INTO array laTotal
>this.value = laTotal[1]
>
>Just my 0.02c CDN :)
>
>Nick
>
>>Hi Peter ---
>>
>>There is a really simple way of doing it. Create a view that queries your view; ie, CREATE VIEW subtot AS SELECT SUM(amount) AS subtot FROM myview. Then bind a disabled or read-only textbox to subtot.subtot and REQUERY() subtot and subtot-bound control refresh() whereever the original view can be modified.
>>
>>
>>
>>
>>>I have a local view of account detail items which I use with a codebook/VFE app. I have a child grid based on the view which works well. The user can scroll up and down to see all of the items (or just the open items) on the account.
>>>
>>>Now I would like to add a running balance to the view.
>>>
>>>So far I've added a dummy field to the view: 000000.00 as yBalance. After I populate the view, I run a scan loop to calculate the balance and plug it in to the yBalance field. This works fine from the command prompt. BTW, I found out that if I defined the field as "0.00" it would not contain more than 3 digits.
>>>
>>>But now when I use the grid in my form I get the message "cannot update the cursor." I get this not only on the REPLACE statement within the scan loop but on the REQUERY() statement before the scan loop.
>>>
>>>Any one have suggestions on the right way to do this?
>>>
>>>Peter Robinson
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform