Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculation in grid AfterRowColChange event
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00696537
Message ID:
00696717
Vues:
13
Jayesh,

Since this is an O(n2) algorithm I wouldn't recommend using it for anything but very small numbers of rows. O(n2) algorithms are very, very bad.

>2. Create new form method and call it Calculate.
>
>3. Drop a Grid on the form with 3 Columns. Last Column should have Thisform.Calculate() as Controlsource.
>
>4. Put the following code into Calculate method.
>
>
>
>LPARAMETERS tnRecNo
>
>LOCAL lnRecNo,lnRtnValue
>
>lnRtnValue = 0
>lnRecNo    = RECNO("c1") - 1
>
>IF lnRecNo >= 1
>	SELECT C2
>	SUM C2.cB FOR RECNO() <= lnRecNo TO lnRtnValue
>	lnRtnValue = lnRtnValue + C1.cB
>ELSE
>	lnRtnValue = C1.cB
>ENDIF
>
>SELECT C1
>RETURN lnRtnValue
>
>
df (was a 10 time MVP)

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

Click here to load this message in the networking platform