Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append from or Copy To with progressbar
Message
De
17/02/2001 23:03:37
 
 
À
16/02/2001 18:28:15
Bryan Palmer
Ramtech Building Systems, Inc.
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00476841
Message ID:
00477084
Vues:
24
>Thanks. My primary reason is for non-foxpro tables. I've got a client who regularly purchases phone lists for his sales people to call. The lists are always in the same csv format. I've got a vfp table that I zap and bring the records into, but I have no way of knowing how many records I'll bring into the new table. I have to use the APPEND FROM file TYPE CSV command to import these new leads. Any suggestions for this?
>

If you didn't use the APPEND FROM, you could process the file using low-level file I/O a line at a time, and report progress at each line (or at every few lines) based on the current file position compared to the total file size. You could count the number of lines in the file by counting the number of newline characters in it ahead of time and adding a UDF() in the FOR clause that threw up a progress bar, but that would slow things down tremendously, since it would require reading the file twice, and calling a UDF() for each line added to the data file. If I desperately needed this, I'd probably go the low-level file I/O route, reading the CSV, populating an array with the values read on each line and doing an INSERT INTO, but it's still slower than APPEND FROM would be by a considerable margin. SET TALK ON will at least report the number of lines appended while appending records, so that the user can tell if the system locks up, but unless you've done something to figure out how many lines total are in the file, it doesn't give them an idea of the relative progress made for the import operation.

Have you considered running the APPEND asynchronously in the background - rather than running it in the foreground, spawn a separate VFP app that actually does the append, and let the user immediately get control of the main app. Obviously, until the second app finishes, the imported data is not available, but the user could do other work while the append ran in the background; it might show as a task on the task bar, with the main screen minimized; you could sense it's status; if you were to start it using my API_APPRUN class, you could check to see if it had finished with the CheckProcessExitCode method. This would not give a progress report, but if the app was capable of doing things independent of the append, it might let the append run separately while the user did other work, and the user could be told when it finished importing the records. With a little work, it might be possible to run the import on a job server - either dedicated, or simply accepting server tasks if currently not servicing an on-line user. It really depends on how much work you want to invest in the process.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform