Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from - is it possible to add progress bar
Message
From
07/12/2000 06:18:28
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00450093
Message ID:
00450283
Views:
43
Hi!

One little and hope addition:
In many commands you can use filtering using 'FOR' clause. You can use UDF there!

So, you can define a form, define function in PRG file that will update status on that form and always return .T. Than use 'copy to ... ... FOR MyFunction()'. Function will be called for each record, so I recommend you to organize something like 'SET ODOMETER' - update status only each 100 records to speed up process. Following is code sample:

*MyFunction.PRG
PROCEDURE MyFunction
if recno() % 100 = 0 && run updating only each 100 records
if INKEY() = 27 && ESC key
GO BOTTOM && force process to finish
return .F.
endif
With m.goStatusForm
.StatusBar.Update(Recno(),reccount())
endwith
endif
return .T.

In sample above StatusBar - your object on the status form which referenced by goStatusForm variable. Update - method that displays percentage of task completeon using records count and current record number.

Note that this will not work properly when table have index set, you need to use another approach to display status in such key (for example, global counter variable increased in above function).

Again, I doubt that you will be able to use Cancel button on the status form, but at least you may try using following:

* use following command before import
ON KEY LABEL LEFTMOUSE do Interrupt.prg

*interrupt.prg:
procedure Interrupt
if m.goStatusForm.MouseClickedOnCancelButton()
go bottom
endif
return

* StatusBar.MouseClickedOnCancelButton()
return Between(MROW(thisform.Name,3),thisform.CancelButton.top,thisform.CancelButton.top+thisform.CancelButton.Height) ;
AND Between(MCOL(thisform.Name,3),thisform.CancelButton.left,thisform.CancelButton.Left+thisform.CancelButton.Width)



Anyway, _VFP.AutoYield shoul be .T. to allow interruptions by keys or mouse.


HTH.

>Hi!
>
>I doubt it will work, but this is the most simple way I know, so you can give it a try:
>
>
>SET TALK ON
>SET ODOMETER TO 100 && update status each 100 records
>SET ESCAPE ON && to allow interrupt
>do myprg.prg && import command here
>SET ESCAPE OFF
>KEYBOARD '' CLEAR
>SET TALK OFF
>

>
>Status displayed for 'copy to' command, when help does not lie. I don't know if you will be able to interrupt, but in my test ran over 100000 of data I was able to interrupt copying process by ESC key at different record numbers, usually such commands checks for ESC key each 2-3 seconds, in addition, I was able to interrupt by several ESC key press, so I recommend you use 'KEYBOARD' command just after copying. In addition, you can try to use 'DEFINE WINDOW' or run modeless form to define status window and show status in that window using 'SET TALK WINDOW ...'. I doubt you will be able to use Cancel button on that form, but you may give a try using combination of 'ON KEY LABEL', '_VFP.AutoYield' and other commands.
>
>HTH.
>
>
>>Hi everyone,
>>
>>Just curios, is it possible to add thermometer during Append From (txtFile) type delimited? I just appended 5mln. records text file and it was not user friendly to see just wait window (fortunately, nobody except me has seen this :))
>>
>>Thanks in advance.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform