NAV Progressbar

AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
edited 2010-03-16 in Download section
NAV Progressbar
Function will easily display a Progressbar with Remaining Time, IntroText & InfoText and this features:
*Supress allways if not guiallowed (NAS-Modus)
*Open a Window with Headline, Progressbar and estimated remaining time.
*Positionfield (Infofield), if activated
*Update the Window at every n step (incl. calculating est. remaining time)
*Every Screenrefresh needs a lot of time! So better use high steps or autostep.
-Steps > 0: Every n. Update will be shown on Screen
-Steps = 0: Update after every 4% (= 25 Updates from 0% to 100%)
-Steps < 0: Autostep e.g. -5: 5 Updates will be done (at 20,40,60,80,100%)
Works in all Navisions from 1 till current (1.x & 2.x: just remove the lines with guiallowed and reduce the Stringlenght to 250 and remove the Cu-ID's).

Example how you did a ProgressBar before:
if guiallowed then
  window.open('I do something\\@1@@@@ #2###########');
Counter1 := 0
Counter2 := Rec.count
repeat
  Counter1 += 1;
  if guiallowed and Counter1 mod 100 = 0 then begin
    window.update(1,round(Counter1/Counter2*10000),1,'>');
    window.update(2,rec.code);
  end;
  do something
until next = 0;
if guiallowed then
  window.close;
You need 3 vars (Counter + Dialog), have to remember allways the Guiallowed (except you are using Navi from 3.x and using the NAS), don't do a division by zero in the progressbar, use the mod (the Window.update needs VERY MUCH TIME!! Don't update it every 1/10 Sec!! The ScreenRefresh needs more Time than your code!)

Now you only need one Var in your code: The CU Progressbar.
the Same Code as above would look like this:
Progressbar.init(Rec.count,100,true,'DoSomething');
repeat
  ProgressBar.update(Rec.Code);
  do something
until next = 0;
reduce the Statewindow to 1 Var (CU ProgressBar) and 2 lines of code! And not slower than before!

http://www.mibuso.com/dlinfo.asp?FileID=1165

Discuss this download here.

Comments

  • rthswrthsw Member Posts: 73
    You dont have the Vartype Duration in this Versions. So just change to Integer and you see the estimated lasting duration in Seconds.
  • vanrofivanrofi Member Posts: 272
    I tried using this in report : perfect!

    I tried using this in a Dataport (to replace the standard status) but the status is 100% from the beginning and time goes negative...

    Any idea?
Sign In or Register to comment.