Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Progress Bar for large table update?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00104180
Message ID:
00104345
Vues:
21
Thanks Jose. I got the same type of answer from Cetin as well. Seems the best way to go.

>>I have a view set to Optimistic Table buffering that I run a calc routine on modifying at least 300+ records. The TABLEUPDATE() takes on average 10+ seconds so I want to display a progress bar so the user knows something is actually happening and how far along it is. This leads me to 2 questions:
>>
>>1. Is there a way to show the progress of a TABLEUPDATE(1,.T.) ?
>>
>>2. Is there a way to find out how many records where modified/appended? If so, I could use this count and GETNEXTMODIFIED() to update a progress bar.
>>
>>TIA
>
>Colin,
>
>You could do this in 2 passes. First use GetNextModified() to get the number of modified/appended records. Then use it for the tableupdate().
>
>LOCAL lnMax, ;
> lnNext, ;
> i, ;
> lnStep, ;
> llToast
>
>*-- set the lnMax to reflect the total amount of changed/modified records (not shown here)
>*-- lnMax =
>
>lnNext = GETNEXTMODIFIED(0)
>
>i = 0
>lnStep = MAX(INT( lnMax / 100), 1)
>
>BEGIN TRANSACTION
>DO WHILE lnNext # 0
> GO (lnNext)
> IF ! TABLEUPDATE()
> llToast = .T.
> EXIT
> ENDIF
> IF MOD ( i , lnStep) = 0
> this.cProgressMeter1.RefreshDisplay(i, lnMax)
> ENDIF
> lnNext = GETNEXTMODIFIED(lnNext)
> i = i + 1
>ENDDO
>
>this.cProgressMeter1.Reset()
>
>IF llToast
> ROLLBACK
> TABLEREVERT(.T.)
> ErrorMsg(this.cMsgUpdateFailed)
> RETURN .F.
>ELSE
> END TRANSACTION
>ENDIF
>
>MESSAGEBOX(DONE_LOC, 64, APPNAME_LOC)
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform