Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Balance
Message
 
 
À
23/09/1998 12:48:52
Senna Dwipayana
Indo Rebel Apparel Cv
Bandung, Indonésie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00139893
Message ID:
00139993
Vues:
16
Senna,

Try this instead:
select (mytable)
nBalance = 0
scan
   nBalance = nBalance + in - out
   replace balance with nBalance
endscan
Your code keeps redoing the work over and over when you do the SELECT inside the loop.

>To count the balance field, usually I do like this :
>Select (mytable)
>Scan
> mrec=RECNO()
> SELECT SUM(out-in) FROM (mytable) WHERE RECNO()> mbalance=total+in-out
> REPLACE balance WITH mbalance
>ENDSCAN
>
>THIS Procedure take to long, specially if I edited a record in the middle, so I have to start all over again.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform