First define a global variable Window type Dialog.
Example :
Salesline.setrange("document no.",Saleshead."no.");
if salesline.find('-') then begin window.open('Updating Sales line for location code ####1###);
repeat
salesline."salesperson code" := Saleshead."salesperson code";
salesline.modify window.update(1,salesline."document no."); until salesline.next = 0;
end;
I would like to add that a dialog si very, very, very, very slow. I strongly recommend you keep the update of a dialog window to an absolute minimum...
Often the update of a dialog in a report costs more time then the report runtime.
A solution could be to update a dialog every x records.
Dialog.open('Processing...\@1@@@@@@@@@@@@@@@@');
IF NumbOfRecsProssed MOD 100 = 0 THEN
window.update(1,ROUND((NumbOfRecsProssed / TotalNumbOfRecs) * 10000,1));
"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."
I would like to add that a dialog si very, very, very, very slow. I strongly recommend you keep the update of a dialog window to an absolute minimum...
[...]
Therefore, in large processings, I update the dialog only if the percentage really change.
So, the dialog will updated exactly 100 times, independent of the number of processed records.
Example:
IF SalesLine.FIND('-') THEN
REPEAT
// [...]
// Percent, PercentOld = Integer
Percent := ROUND((CurrRec / NoOfRecs) * 10000,1);
IF Percent <> PercentOld THEN BEGIN
Window.Update(1,Percent);
Percent := PercentOld;
END;
UNTIL SalesLine.NEXT = 0;
So you use 6 lines of code where eromijn uses 2 for the same effect
Yes, that's right!
But sometimes an update after every 100 records could be to fast anyway.
So, in very large processings, this is the better way. :roll:
[...]
Where (TotalNumbOfRecs * 10 / 100) is 10% if the total number of records. So in this sample you only update your dialog with steps of 10%.
That is... If I didn't make a mistake here offcourse.
I throw in the towel - you get the cup
Your way is the most flexiblest because you can decide any percentage where the dialog should be updated. :roll:
Comments
Here is an example of Dialog.
First define a global variable Window type Dialog.
Example :
Salesline.setrange("document no.",Saleshead."no.");
if salesline.find('-') then begin
window.open('Updating Sales line for location code ####1###);
repeat
salesline."salesperson code" := Saleshead."salesperson code";
salesline.modify
window.update(1,salesline."document no."); until salesline.next = 0;
end;
Hope this helps !!!!
Regards
Suresh.
Often the update of a dialog in a report costs more time then the report runtime.
A solution could be to update a dialog every x records.
If it was hard to write, it should be hard to understand."
So, the dialog will updated exactly 100 times, independent of the number of processed records.
Example:
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
RIS Plus, LLC
But sometimes an update after every 100 records could be to fast anyway.
So, in very large processings, this is the better way. :roll:
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Where (TotalNumbOfRecs * 10 / 100) is 10% if the total number of records. So in this sample you only update your dialog with steps of 10%.
That is... If I didn't make a mistake here offcourse.
If it was hard to write, it should be hard to understand."
Your way is the most flexiblest because you can decide any percentage where the dialog should be updated. :roll:
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Tadadaaaaaa... Tadadaaaaaa... Tadadaaaaaa... etc...
If it was hard to write, it should be hard to understand."
RIS Plus, LLC
Choose shorter var names then it should fit.
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
RIS Plus, LLC
Variable names like T_SH for SalesHeader and T_C for Cust.
And just to make you all understand how bad this is.... here's a popquize:
What is the subtype of the variable T_IJ?
If it was hard to write, it should be hard to understand."
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
RIS Plus, LLC