Index progress bar

HMG en Español

Moderator: Rathinagiri

trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Index progress bar

Post by trmpluym »

In the good old Clipper days i used an progress bar function (NtxBar) for indexing (0% to 100%). Here a Clipper code snippet:

INDEX ON &cNdxExpr TAG (cNdxName) UNIQUE FOR !Deleted() TO (cDbfName) eval NtxBar(aStat) every (aStat[4])

Now i like to accomplisch the same in HMG, but I'm stuck.

The goal is to use a modal window in the main window showing a 0% to 100% status bar during the indexing process.

See in the attachment my coding result until now. Two problems:

1. The indicator is not showing the right lenght. When the counter is 100% the progressbar is at 95%. The progress bar seems to delay 5% but the value (nX) is the same ! Strange, why ?

2. How to implement this progressbar in an eval() function (can be used in index on ... )

Or is there a simpler \ smarter way to create a progress bar in a modal window ? Somebody else has got a good indexing progress bar example ?
Attachments
ProgressBar.zip
Demo file
(1.08 KiB) Downloaded 349 times
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Theo,

Your PRG seems OK to me. See att.

I will search for EVAL sample.


Serge
Attachments
100.png
100.png (2.31 KiB) Viewed 12188 times
95.png
95.png (2.59 KiB) Viewed 12188 times
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Theo,

Found this: (in my samples)

Code: Select all

...
nRecsDone := 0
FORM_CONTACT.Progress_1.Value := nRecsDone
USE Tipos ALIAS Tipos EXCLUSIVE
nLastRec := LastRec()
INDEX ON STR(Cod_Tipo, 3) TAG Cod_Tipo
INDEX ON HMG_Upper(Desc) TAG Desc
REINDEX EVAL {|| InProgress(nLastRec) } EVERY 10
....

Function InProgress(nLastRec)
nRecsDone := nRecsDone + 10
FORM_CONTACT.Progress_1.Value := ( nRecsDone/nLastRec ) * 100
hb_IdleSleep( 0.2 ) // When dbf is too big, pls cut off this
Return .T.
I haven't tested this myself

Serge
There's nothing you can do that can't be done...
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Index progress bar

Post by dragancesu »

The progress bar is nice but unnecessary, in this case "L'art pour l'art"

I think it would be useful to show how the table is indexed

For example, there are 10 tables, 15 index, then to count from 1 to 15 and to show the progress bar and possibly write the name of the tables and indexes
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Maybe true, maybe not.

Nature of the question was not aesthetical or arty but technical!

S
There's nothing you can do that can't be done...
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

Hi Serge,
Serge wrote:"Your PRG seems OK to me. See att."

Thanks again for your help !

I tried both HMG 3.4.0 and 3.4.2 and both show me:
ProgressBar.png
ProgressBar.png (3.03 KiB) Viewed 12170 times
Strange because the nX value is the same. Do you use another compiler ?
Last edited by trmpluym on Sun Feb 28, 2016 11:31 am, edited 2 times in total.
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

dragancesu wrote:The progress bar is nice but unnecessary, in this case "L'art pour l'art"
indexes
For small indexes it is. But for large indexes it informs the user what is happening so the don't think the program is 'frozen'.
dragancesu wrote: I think it would be useful to show how the table is indexed

For example, there are 10 tables, 15 index, then to count from 1 to 15 and to show the progress bar and possibly write the name of the tables and indexes
I like to see a progress bar per index. So for 10 tables with 15 indexes. I like to see 15 index progress indicators (one by one after eachother) processing from 0% to 100%. More clear ?
Last edited by trmpluym on Sun Feb 28, 2016 11:36 am, edited 1 time in total.
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Theo,

I use HMG3.4.2 on W7 PC.

Serge
There's nothing you can do that can't be done...
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

serge_girard wrote:Theo,

I use HMG3.4.2 on W7 PC.

Serge
Hmm, strange mine is also HMG3.4.2 on W7. I will send you my EXE in a PM. Gan you give it a try ?
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Yes, I can!
S
There's nothing you can do that can't be done...
Post Reply