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
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;)
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)...
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... ;-)
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...
Comments
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
Thank you for the reply.. i am getting division 0/0 error.. can u specify why
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;)
Arhontis
https://forum.mibuso.com/search
Lat me take a look into your code snippet
regards
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
But I have always used it in the OnAfterGetRecord of reports, so it always has something... [-X 8)
Arhontis
https://forum.mibuso.com/search
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...
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...
Arhontis
https://forum.mibuso.com/search
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!