Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating an index field
Message
De
10/11/2004 12:48:11
 
 
À
09/11/2004 23:45:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00959514
Message ID:
00960107
Vues:
9
>>>Hi All
>>>
>>>I have a table and for each record I want to execute a process and then store the datetime when the process for that record was completed.
>>>
>>>I also want to process the records in this same datetime order so that I can loop through all records and process each from the oldest record on file to the most current. So there is an index on that datetime field and which is set as the index to use for dropping through the file.
>>>
>>>Of course as soon as I update the first record with the current datetime it moves to the end of the index and the subsequent SKIP positions me at EOF.
>>>
>>>I cannot GO TOP since that would put the app in an endless loop. I want to process all the records once, from oldest update to latest udpate.
>>>
>>>I can store the update datetime into a second field and then go back over all records when the entire file is done and update the index datetime field with this second field but that would mean that a second instance of my app would not know the correct record to process next <g>
>>>
>>>Anybody had a similar situation with an elegant solution?
>>>
>>>Thanks
>>
>>You could use your table using the AGAIN with a different alias. SCAN through one of the aliases of your table and UPDATE the other.
>
>Hi Fred. The table I use for the SCAN needs to be in the update datetime field order. If I update this field in the other copy of the table would this change not reflect in the SCAN copy of the table and then cause the same problem (which is why I didnt try this option)?

Hmm, it might. If you're updating the field the SCAN is using, it probably will change the order. Later on you might be processing the same records again. You could do a SELECT into an array (I think someone else suggested this), or do a SELECT into a cursor and SCAN the cursor. That way, no updating would impact the SCAN.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform