Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop through record's fields
Message
De
21/09/2007 00:27:08
 
 
À
19/09/2007 12:51:22
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01255535
Message ID:
01255881
Vues:
9
>How can I loop through all the fields (assuming only one record to start, but there could be more eventually) and concatenate all the resulting values into one string?

Jay,

the approach you discuss later on is workable - but if the "more eventually" comes into large table range and/or the table has many fields, the concatenate operation itself (because the string has to be recopied again and again) can become troublesome.

Adding to a file will become faster (because the no string reallocation occurs) or an alternate approach like building line concatenating all fields in one instruction will help. Again, the value here is not saving the loop by replacing it with a makroexpansion, but reducing the number of string movements of growing strings. On multimillion record tables it would be reccomended to add the bracketing scan / endscan and execscript and compile that so that you eliminate the makroexpansion for each record.

The time needed will depend on the string length and the number of operations: if the scan loop takes more than a second (or needs to be performed in a loop as well) take a look at the options described. 10**5 operations are a breeze, around 10**6 you will start to feel the exponetial perf drag.

HTH

thomas
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform