Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Columns total
Message
De
21/03/2006 13:56:49
 
 
À
21/03/2006 09:08:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01106199
Message ID:
01106324
Vues:
21
>>Hi
>>If I have cursor with few fields (The columns names and count is not permanent but data type always is integer).
>>The first column name is permanent.
>>I want to add column to total the values in all columns for each line without the first column (second column and onward).
>>Help plesae
>
>Chaim
>
>Not sure if you mean add an extra column that holds the total of all the other cols in each rec:
>
>
>Update SubjTable add column COLTOT
In my (older) version of VFP UPDATE doesn't support adding columns.
ALTER TABLE SubjTable ADD COLUMN coltot N(10,2) can be used instead
>Select SubjTable
>Locate
>Scan
>  lnColTot   = 0
>  LnColCount = FCOUNT()
>  For lnCol = 2 to lnColCount-1
>    lcCol    = FIELD( lnCol)
>    lnColTot = lnColTot +  &lcCol
>  EndFor
>  Update SubjTable set COLTOT = lnColTot
The scope for UPDATE is all records unless restricted by a WHERE clause.
I think, within the context of a SCAN loop, that a REPLACE would be better.
>EndScan
>
>
>HTH
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform