NetTalk Central

Author Topic: Progress Bar disappearing during process  (Read 4465 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Progress Bar disappearing during process
« on: December 29, 2016, 10:22:01 PM »
Hi Bruce
Following on from yesterday's Webinar regarding the progress bar issue experienced by myself and Ashley.
I have modified the web72 example.
Before these changes I ran the example and it completed the file make.
In the ProcessMakeFile procedure.
DataSection
I added a variable recordsize as a long
ProcessedCode
Before the loop I set recordsize to 5000
I then looped from record 1 to 5000
I changed the percentagecomplete calculation to x * 100/recordsize
I added a StringTheory Local Object (st) and added a st.trace to monitor the process
On running this it exhibits exactly the symptoms we described.

The progress bar displays for a short while and then disappears.
However the process still continues.
Checking Web72.exe in TaskManager shows cpu activity (mine hovers around 12)
Using debugview I can see each traceline

Observations.
If I rem out the artificial delay the progress bar does not disappear ( in this example)
As I mentioned anectodally if I change the StartProcess File Tab PageProcess Progress Timer to (say 20000) the progress bar stays visible.
As a layman's observation it seems as though if the ProgressTimer interval is not large enough for 1% to be calculated in the loop that is when the progress bar disappears.
What I mean is if the progressInterval is 2000 (2 seconds) and it takes more than 2 seconds for 50 records to be processed in this example then the progress bar disappears
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Vinnie

  • Full Member
  • ***
  • Posts: 183
    • View Profile
    • Email
Re: Progress Bar disappearing during process
« Reply #1 on: December 30, 2016, 12:08:13 AM »
Thanks for that Terry.

I have run into the same problem so I have adjusted them timer to 8000 (8seconds) and the progress bar is working now.

Thanks for this information.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Progress Bar disappearing during process
« Reply #2 on: December 30, 2016, 05:50:56 AM »
Hi Terry,

Thanks for the example. As always it's the fastest way to get to the heart of the problem.

As I predicted in the webinar yesterday, the key is that your progress bar is getting to 100 before the loop (and file) is completed.
In your code you have;

   PercentageComplete = x * 100/recordsize                       
  p_web.SetProgress(loc:ProgressName,PercentageComplete,'') 


If you do a TRACE after that line, and another after the final line;

p_web.SetProgress(loc:ProgressName,100,GLO:DosFileName)

You will see that it gets to 100 before the loop completes (ie in the first SetProgress.)

As I pointed out in the webinar 100% is only valid _after_ everything about the file has been done.

If you adjust your code as follows then you should be fine.

   PercentageComplete = x * 100/recordsize                       
  If PercentageComplete  > 99 then PercentageComplete  = 99.
  p_web.SetProgress(loc:ProgressName,PercentageComplete,'') 


If of course you still have a problem please post a modified example.

Cheers
Bruce


terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Progress Bar disappearing during process
« Reply #3 on: December 30, 2016, 09:04:06 AM »
Hi Bruce.
Attached is the same example with your suggested code inserted.
I still see the same issue, the progress bar disappears. In fact I had already used your suggestion in my standard code when I was trying to solve the problem myself.
However if I have debug view on when I run the code the bar disappears after only 10 or so records have been processed, not when the PercentageComplete is anywhere near 100%.

Going back to my observation what would be the result if after the 2 second waiting interval at the beginning of the process the calculated PercentageComplete was less than 1. I think this is where the problem appears.
It also explains why the same source procedure of mine has no problem when it is processing a file with a few records in it but later fails as the number of records it is processing increases. Solving that issue could then be done by increasing the waiting period
If you look at the attached code I have added a line which is currently remmed out.

IF PercentageComplete < 1 THEN PercentageComplete = 1.
If you run the procedure with this line remmed out the progress bar disappears after about 10 records have been looped through.
If you enable this line then irrespective of the size of the waiting interval the code completes.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Progress Bar disappearing during process
« Reply #4 on: January 02, 2017, 03:40:57 AM »
Correct yes - the progress must be > 0 when it starts, and then < 100 until it is completely finished.
Making sure that it does not reset the progress abck to 0 is just as important as making sure it doesn't get over 99.
And that's something I think the current report template is _not_ doing, so definitely something I'll add in for the 9.17 build.

cheers
Bruce