Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append from - is it possible to add progress bar
Message
 
 
À
06/12/2000 15:55:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00450093
Message ID:
00450199
Vues:
54
>Payback maybe? I too append into my VFP tables from text files. I have insured each text record is delimited with $, just to be safe.
>
>My code is probably not as elegant as yours... but I am still learning. I have used this for 3.5 million records. Some may say it is 'slow', but it works for me.
>
>Here is some excerpts..
>
>
>LPARAMETER lcFile
>*** lcFile is the text file....
>_SCREEN.MousePointer = 11
>
>lnHandle =FOPEN(THISFORM.cPath+lcWorkFile)
>lnPoint =FSEEK( lnHandle,0,0)
>lnCount= 0
>
>** Here is my wait window... I also have a 'blinking screen' method which adds ** a pizazz to keep the user 'occupied' (the more color, the more it is
>** working!) I use a WIN API to move the message box around a bit, here and
>** there. The 'count' process immediately below can be long.
>lcMessage = "Cross Checking Records - Upload....Please Be Patient....Counting Out "
>
>DO WHIL .NOT. FEOF( lnHandle )
> lcLine =FGETS(lnHandle)
> lnCount = lnCount + 1
> lcMessage1 = lcMessage + ALLTRIM(STR(lnCount))
> ******Show the window again spinning numbers make users feel important...
> WAIT WIND lcMessage1 NOWAIT
>ENDDO
>** Empty file trap
>IF lnCount < 1
> _SCREEN.MousePointer = 0
> RETURN
>ENDIF
>
>*** Do some stuff to set up my tables
>
>** Reset my file pointer
>lnPoint=FSEEK(lnHandle,0,0)
>
>** setup thermo...
>
>lnThermBasis = lnCount
>lcThermTitle =IIF(SUBSTR(UPPER(ALLTRIM(lcWorkFile)),1,2)"CL","Client","Product")
>lcThermTitle = lcThermTitle + " Update - Clearpath"
>lcThermTaskTitle = "Cross Checking Records - Upload"
>lcThermTaskName = "Loading From Clearpath Source File....."
>oThermo =NewObject("c_thermo_form", "class\c_object\c_object_therm",.NULL., ;
> lcThermTitle, lcThermTaskTitle, lnThermBasis, 0)
>oThermo.Show()
>
>****pick up records from text file....
>DO WHIL .NOT. FEOF( lnHandle )
> lnOnRecn = lnOnRecn + 1
> lcLine =FGETS( lnHandle)
> lcLine = ALLTRIM(lcLine)
> lnDelimit =OCCURS("$",lcLine)
> llIsError = .F.
> *** Put the data where it belongs
> *** Now, update our thermo.....
> lcThermTaskName = "Loading From Clearpath Source File.....File Number: "
> lcThermTaskName = lcThermTaskName + ALLTRIM(STR(lnOnRecn))
> lcThermTaskName = lcThermTaskName + " Of Record Count Total: "
> lcThermTaskName = lcThermTaskName + ALLTRIM(STR(lnCount))
> lcThermTaskName = lcThermTaskName + " Update Procedures."
> oThermo.therm_update(lnOnRecn,lcThermTaskName)
>ENDDO
>llClose =FCLOSE( lnHandle)
>_SCREEN.MousePointer = 0
>oThermo.therm_complete(lcThermTaskName)
>IF TYPE("oThermo") == "O"
> oThermo.Release()
>ENDIF
>RELEASE oThermo


Hi Ric,

I was thinking about the same approach, but I'm afraid, it's going to be much slower, than native append from command. I will try tomorrow (if find time, of course :)) on smaller files to see, if it's worth to code it or better just forget about it at all.

Another idea: Play an animation (AVI file) during the process. I haven't tried it yet, but I may investigate this route. May be some experts will jump into this thread.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform