The Perfect Progress Bar

Calico
Member Posts: 31
Can anyone advise on how to create the "perfect" progress bar? By that I mean one that reaches 100% as the process it is indicating completes. In the formula -
Window.UPDATE(1,ROUND(Counter/RecordCount * SomeNumber,1));
what relationship should "SomeNumber" bear to "RecordCount"? A lot I see are just set at 10,000 but some are a calculation based on RecordCount such as POWER(10,STRLEN(FORMAT(RecordCount))). And should the rounding be up or down?
And in the Text Constant are there any guidelines for the length of "@1################## " based on the number of records?
A lot of progress bars show 100% well before the process has actually completed and whereas others only reach 10%. The former is annoying and the latter disconcerting for the user. I'd be interested, and grateful for any advice.
Window.UPDATE(1,ROUND(Counter/RecordCount * SomeNumber,1));
what relationship should "SomeNumber" bear to "RecordCount"? A lot I see are just set at 10,000 but some are a calculation based on RecordCount such as POWER(10,STRLEN(FORMAT(RecordCount))). And should the rounding be up or down?
And in the Text Constant are there any guidelines for the length of "@1################## " based on the number of records?
A lot of progress bars show 100% well before the process has actually completed and whereas others only reach 10%. The former is annoying and the latter disconcerting for the user. I'd be interested, and grateful for any advice.
0
Comments
-
This How To can be useful: How To use a progressbar in Dynamics NAV?
As is this download: NAV ProgressbarNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Thanks for the reply but unfortunately the only thing "How To" tells you is not to update the dialog with each iteration - which I already know and (don't) do. The examples in both the "How To" and the download use a multiplier of 10,000 but without any explanation, although the code in the download itself rounds down. Why 10,000?0
-
1% is devided into 100 parts which means when you've got 100 (%) * 100 (parts) = 10.000 steps until you reach the whole progress bar (100%)."Money is likewise the greatest chance and the greatest scourge of mankind."0
-
The issue is that most people setup progress bar based on number of records that it is looping and if you have looped through all the records, you have reached the end 100%.
What they fail to realize that these processes are manipulating data on a database and at the end the NAV client commits the transaction, and that takes time.
So in a lot of these processes you reach 100 percent but still have to wait till the process commits the data. This is now more true since we have bulk insert.0 -
As a general rule always update the progress bar at the latest possible moment after all the processing has been done and not at the beginning.
Always round down so that you don't reach 100% too early. This will solve updating the progress bar even if you loop through 1.000.000 records or more.
If you have a fixed number of records to loop through such a progress bar is easy.MaxCnt := Table.COUNT; Cnt := 0; Repeat cnt += 1; ... Your processing here ... Progressbar.update(round(cnt / maxcnt * 10000, 1, '<')); Until Table.next = 0;
Done.
But what if you don't know how many records your loop will need to process before starting the loop? E.g. the Adjust Cost Item Entries does not know at the beginning so it is not possible to fill MaxCnt.
Or in a Repeat Until there is an exit condition so the progress bar goes to 22% and the next thing you know it is finsihed and never reached 100%. I personally think that in these cases there should be no progress bar but just an indication that NAV is still doing something (like an Integer counting up).Frank Dickschat
FD Consulting0 -
ara3n wrote:The issue is that most people setup progress bar based on number of records that it is looping and if you have looped through all the records, you have reached the end 100%.
What they fail to realize that these processes are manipulating data on a database and at the end the NAV client commits the transaction, and that takes time.
So in a lot of these processes you reach 100 percent but still have to wait till the process commits the data. This is now more true since we have bulk insert.
The fact is that the dialog bar does go to 100% early. Try this ...window.open('@1###################################'); window.update(1, 9912); sleep(1000); window.close;
It will show 100%, but simple rounding shouldn't get you 100% before 9950 and even that may be too soon for the users. So as the bar can only show percent anyway (the blue bar too) you may be better off doing a ROUND(abc,100,'<') rather than a ROUND(abc,1).
Even so I do tend to show the commit as a distinct dialog message.Robert de Bath
TVision Technology Ltd0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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