Running Progress Bar

sankarsankar Member Posts: 79
Hi Experts,

Can any one tell me how to run a progress bar in navision 3.7.. i am creating search function i need this run....

Sorry i have posted this into navision3.6.. please can any one help
Everything is Possible

Comments

  • garakgarak Member Posts: 3,263
    What does the "search function" do? Goes trough filtered records usin an loop:?:

    if yes:

    Text0001 = 'Processbar @'

    RecordVar.setrange(...);
    Counts := RecordVar.count;
    if counts <> 0 then begin
    RecordVar.findset;
    DLG.open(Text0001)
    repeat
    i += 1;
    DLG.update(1,round(i*100/counts*100,1));
    until RecordVar.next = 0;
    DLG.close;
    end;

    DLG ist an variable type dialog
    i is an integer
    counts is an integer
    Text0001 is an TextConst

    Regards
    Do you make it right, it works too!
  • sankarsankar Member Posts: 79
    Hi,

    Thank you for the reply.. i am getting division 0/0 error.. can u specify why
    Everything is Possible
  • ArhontisArhontis Member Posts: 667
    Hi,

    As you might already know the division by zero comes when deviding by zero lol... I guess you have no recs in your record (look at the assign Counts := RecordVar.count;)
  • garakgarak Member Posts: 3,263
    i beleive, that the variable counts has an zero value.

    Lat me take a look into your code snippet

    regards
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,118
    I put the responses of the other post in this one, because the other post will be deleted later. And some posts are usefull.
    Arhontis wrote:
    Hi,

    Please don't multiple post on different forums... :)

    Declare a text constant like Text001 and value:
    'Doing somethin @'

    Make a couple of variables:
    i:integer
    NoOfRecs:integer
    Window:Dialog

    before the code loop:
    NoOfrecs := Somerecord.COUNT; 
    i:=0;
    Window.Open(Text001); //to open the window
    
    in the code loop do something like:
    Window.UPDATE(1, ROUND(i/ NoOfRecs * 10000,1));//to update the progress bar...
    i:=i+1;
    
    After the code loop:
    Window.Close;//to close the window
    

    In case you use the progress bar control on a form you should do the same when updating the value that the progressbar shows (assign with the 10000 calculation above)...

    I hope this helps...

    Savatage wrote:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    And what you are doing, if there are no records? There is no such a code, which will prevent you from updating the dialog with values 0/0 when no records are found... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ArhontisArhontis Member Posts: 667
    As you already know there is a development rule: "When dividing always check before if it is zero."

    But I have always used it in the OnAfterGetRecord of reports, so it always has something... [-X 8)
  • sankarsankar Member Posts: 79
    Hi,
    Thank u experts i got the progress bar running in report.. i want to do the same in form.... how can i do that where i want to code this...
    Everything is Possible
  • ArhontisArhontis Member Posts: 667
    Look above, there is some info at the post that kriki moved here...

    It is almost the same, but you must use a progressbar from the toolbox on your form and assign a var and move your var like the UPDATE you did already...
  • krikikriki Member, Moderator Posts: 9,118
    Check also my post in this topic: http://www.mibuso.com/forum/viewtopic.php?t=10516
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.