Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from - is it possible to add progress bar
Message
From
06/12/2000 15:55:09
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00450093
Message ID:
00450103
Views:
35
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform