how to use progress indicator in report
tneurb
Member Posts: 9
Hi all Expert .Can u Tell me how to use Progress Indicator.
Where the Trigger can i put the code.
Where the Trigger can i put the code.
0
Comments
-
Hi tneurb
do the following
declare 3 variables
window of type dialog
TotalRec of type integer
CurRec of type integer
in OnPreDataItem section
window.OPEN('Processing @');
TotalRec := COUNT;
in AfterGetRecord section
CurRec := CurRec + 1;
window.Update(1,ROUND(CurRec / TotalRec * 10000,1);
in OnPostDataItem
This should do the trick
window.CLOSE;0 -
thank you very much0
-
Note: you can use COUNTAPPROX instead of count, it is faster and was created exactly for this.
Do It Yourself is they key. Standard code might work - your code surely works.0 -
-
Shenpen wrote:Note: you can use COUNTAPPROX instead of count, it is faster and was created exactly for this.
Countapprox only works differentley from COUNT if you have SQL, I thinkCOUNTAPPROX (Record)
Use this function to obtain an approximate count of the number of records in the table, for example, for updating progress bars or displaying informational messages.
Number := Record.COUNTAPPROX
Record
Data type: record
Refers to the table to be counted.
Number
Data type: integer
The number of records in the table.
If a filter has been set on the record, this function will behave exactly as the Record.COUNT function.
Comments
The count is approximate because it uses statistical information maintained by SQL Server, which is not kept precisely in synchronization with modifications to the table and is not under transaction control. However, it is much faster to use this information than to perform an accurate record count under transaction control, especially when there is a large number of records in the table.
Example
This example shows how to use the COUNTAPPROX function. The statement:
Number := Customer.COUNTAPPROX;
assigns the approximate number of records in the Customer table to the Number variable.0 -
Key quote:
Modifying one line of code is usually not going to make much of a difference, it's repeated statements and inefficiencies in processing code that make a difference.If a filter has been set on the record, this function will behave exactly as the Record.COUNT function.
Most of the time, a progress bar slows down the process because of the constant updating. Executing one line of code takes almost nothing in terms of time, but for some reason repainting the dialog box does. If one of your reports is slow because of a progress bar, you need to limit the number of updates, say once every 100 updates, or only update every so many seconds.0 -
From the navision reminders:
NewTime := TIME; IF (NewTime - OldTime > 100) OR (NewTime < OldTime) THEN BEGIN NewProgress := ROUND(RecordNo / NoOfRecords * 100,1); IF NewProgress <> OldProgress THEN BEGIN Window.UPDATE(1,NewProgress * 100); OldProgress := NewProgress; END; OldTime := TIME;0 -
Yes, it is true. I used to use Dialogs to in a MyDialog.UPDATE(1,MyItem."No.") - style for all data migration & repair programs just to avoid freezing finsql.exe and I found in awe that their performance bottleneck is not reading the database, but updating the dialog. Updating progress bars or dialogs just on every 100 records sounds like a good idea.
(Fun stuff: if you want to write a really _slow_ program, call COUNT on every record, updating the progress bar instead of storing the record count
A coworker once did it by mistake, and later on when I corrected it the client was quite surprised that a report can be made 10 times faster with only 30 seconds of hacking 

)
Do It Yourself is they key. Standard code might work - your code surely works.0 -
Hey maybe that will mke your customers happy... Make their stuff work really slow at first and then go in later and make "improvements"
0 -
Another reason to follow your approch denster is to improve the performance gradually. As they do business, the database starts to grow and the reports run longer and longer, so if you make the report run slow at the beginning and gradually improve the performance, they won't complain 5 years down the road.
0 -
If you design a new report, performance is part of the initial design. 8)
It is not something you do afterwards. [-X
This is why so many navision customers are dissapointed.
0 -
I agree and the report will run at optimal, it's just you add window.update for every record, or record.count for every update, These additional functions will mimic how fast the report will run 5 or 10 years from now, and gradually you remove these functions. This whole thing was meant as joke, don't take it serously.0
-
Albertvh wrote:Hi tneurb
do the following
declare 3 variables:
window of type dialog
TotalRec of type integer
CurRec of type integer
in OnPreDataItemwindow.OPEN('Processing @1@@@@@@@@'); TotalRec := COUNT;in AfterGetRecordCurRec := CurRec + 1; window.Update(1,ROUND(CurRec / TotalRec * 10000,1);
in OnPostDataItemwindow.CLOSE;
window.Update(1,ROUND(CurRec / TotalRec * 10000,1));
1 more parentasis 8)0 -
Maybe we should build a dynamic performance enhancement add-on that calculates per how many records it updates the dialog depending on the number of records in the database
0 -
-
DenSter wrote:yeah you can save a whole milisecond on that one line of code!!

I was just reading this post again - C'mon that's funny =D>0 -
Ah, but 5 or 10 years from now they will have upgraded to a new version of Navision, and it will be much slower then the prior version, so you will need every trick you can think of to help with speed.ara3n wrote:I agree and the report will run at optimal, it's just you add window.update for every record, or record.count for every update, These additional functions will mimic how fast the report will run 5 or 10 years from now, and gradually you remove these functions. This whole thing was meant as joke, don't take it serously.
0 -
themave wrote:
Ah, but 5 or 10 years from now they will have upgraded to a new version of Navision, and it will be much slower then the prior version, so you will need every trick you can think of to help with speed.ara3n wrote:I agree and the report will run at optimal, it's just you add window.update for every record, or record.count for every update, These additional functions will mimic how fast the report will run 5 or 10 years from now, and gradually you remove these functions. This whole thing was meant as joke, don't take it serously.
I give up. :-#0 -
I am only jokingara3n wrote:themave wrote:
Ah, but 5 or 10 years from now they will have upgraded to a new version of Navision, and it will be much slower then the prior version, so you will need every trick you can think of to help with speed.ara3n wrote:I agree and the report will run at optimal, it's just you add window.update for every record, or record.count for every update, These additional functions will mimic how fast the report will run 5 or 10 years from now, and gradually you remove these functions. This whole thing was meant as joke, don't take it serously.
I give up. :-#
0 -
I was too :P0
-
We could start a new thread titled
"We just finished upgrading and now Dynamic Nav is so slow" [-o<0 -
If you add
if CurRec MOD 10 = 0 then
window.Update(1,ROUND(CurRec / TotalRec * 10000,1));
the window is updated once every 10 records. That will save more than just a millisecond on tables with many records.
Kai Kowalewski0 -
For long running reports as an "upgrade" I sometimes put info with estimated execution time. It doesn't do much but its nice to look at
0 -
Savatage wrote:Albertvh wrote:Hi tneurb
do the following
declare 3 variables:
window of type dialog
TotalRec of type integer
CurRec of type integer
in OnPreDataItemwindow.OPEN('Processing @1@@@@@@@@'); TotalRec := COUNT;in AfterGetRecordCurRec := CurRec + 1; window.Update(1,ROUND(CurRec / TotalRec * 10000,1);
in OnPostDataItemwindow.CLOSE;
window.Update(1,ROUND(CurRec / TotalRec * 10000,1));
1 more parentasis 8)
Why is it that the "Cancel" button doesn't work?
However, pressing the escape key does?
Is there an event that I need to be testing for? Or is it supposed to be handled by the dialog itself?
Thanks in advance,
Kevin0 -
-
Using count or countapprox sux(lol Savatage). Using the updating window when running anything sux your performance dry. If you cant avoid these do only update every 1000 or 10000 records/cycles.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions




