Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enhancing Performance
Message
From
21/06/2014 11:01:54
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/06/2014 02:38:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01602118
Message ID:
01602167
Views:
88
>Thanks to All of you
>
>seems that the Insert Command is making the process Delay. I got the logic you suggested.

Rich is mistaken. You are not using the old dbase INSERT command. The insert you are doing adds records only to the end of a table. There is no faster way to add a record to the end of a dbf

>
>Regards
>Harsh
>
>
>
>>>Performance Increased a Lot particularily by Using
>>>
>>>IF MOD(lnCount, 100) = 0
>>>WAIT WINDOW 'Remaining Records...'+ALLTRIM(STR(RECNO())) NOWAIT
>>>ENDIF
>>>
>>>However this line is inserting records at the bottom of file and not below the required record so I have kept my original code there
>>>
>>>INSERT INTO BillFile (POS) VALUES (cTexttwo)
>>>
>>>Any suggestion , Please Intimate
>>>
>>>Harsh
>>
>>The old INSERT command has been deprecated in VFP (meaning it is still there but it isn't recommended that you use it).
>>
>>If I remember correctly, that's because it needs to rebuild the file each time you do the insert command. For small files, the processing time is negligible and doesn't have a material impact on performance. But, the bigger the file, the longer each iteration takes and you reach a point where the system slows to a crawl.
>>
>>I would suggest something like
>>SELECT *,000000000.0000 as SortKey FROM billfile INTO CURSOR billfile2 READWRITE
>>REPLACE ALL sortkey WITH recno() IN billfile2
>>lnInsertnum = 0.0000
>>
>>** Do your code and when you come to the point where you want to do the insert
>>
>>
lnInsertnum = lnInsertnum + .0001
>>lnSortKey = sortKey + lnInsertNum
>>
>>INSERT INTO billfile2 VALUES ( < all the insert values >,lnSortKey)
>>
>>** finish your code.
>>
>>At the end you can
>>
SELECT < all the fields except sortkey > FROM billfile2 ORDER BY sortkey INTO CURSOR billfile READWRITE
>>
>>and I would expect the records to be in the sequence you want. If the way I've expressed it isn't clear, maybe somebody can explain it better.
>>
>>........Rich
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform