>Hi everyone,
>
>I just found out, that I need to update my database every month, e.g. do append from a text file with ~ 7 mln. records. Therefore I'm asking just one more time, how can I add a progress bar, but not slow down the perfomance significantly?
>
How about just SET TALK ON with a reasonably large SET ODOMETER setting? Perhaps that won't kill performance too badly.
>May be somebody already wrote simple to use Progress Bar for Append from text file...
>
>Thanks in advance.
>
>>>>I don't know in advance how many records I have in a file.
>>>
>>>Guess, take the total K of the file and guess how long a record might be. Or take the total, divide it by something like 100 or 1000 and then extract rows until you have that long of a string.
>>
>>>>I don't know in advance how many records I have in a file.
>>>
>>>Guess, take the total K of the file and guess how long a record might be. Or take the total, divide it by something like 100 or 1000 and then extract rows until you have that long of a string.
>>
>>Hi Mike,
>>
>>I've thought about it a little bit more, and I think, I found a simple and a quite elegant solution.
>>
>>Bellow is a pseudo untested code (write it from the top of the head):
>>
>>local lnSize, loTerm, lcTempFile, lcLongStr, lcStr, lnSizeRead
>>lnSize=fsize(lcTextFile)
>>loTerm=newobject('thermometer', 'wg.vcx','','Appending',lnSize)
>>lcTempFile=gcTempPath+sys(15)
>>fh=fopen(lcTextFile)
>>lnSizeRead=0
>>select WorkTable
>>do while !feof(fh)
>> lcLongStr=''
>> for i=1 to 500
>> if feof(fh)
>> exit
>> endif
>> lcStr=fgets(fh,2000)
>> lnSizeRead=lnSizeRead+len(lcStr)
>> loTerm.update(lnSizeRead)
>> lcLongStr=lcStr+chr(10)+chr(13)
>> next
>> =strtofile(rtrim(lcLongStr),lcTempFile)
>> append from (lcTempFile)
>>enddo
>>release loTerm
>>
>>This is the idea. The similar idea could be used for append from table. Divide number of records, say, by 1000 and do append for betwen(recno(),lnStart, lnFinsish) in a loop (You got the idea).
>>
>>Ok, what do you think?