on ‎2005 Jun 12 10:07 PM
Hello,
One of the DynPro UI's is a progress bar.
I have a certain view which loads a ResultSet from a certain DB. This ResultSet is being loaded to the view in a while(rs.next()) loop and since it contains huge amount of records it takes it few minutes to load.
Can someone please show me an example of how can integrate such a progress bar in the view which will display the amount of time left for loading?
Request clarification before answering.
Hi,
There wont be a direct way to get it.. You can get the system time before and after the execution of the query and play with it.. For every pass through while(rs.next()).. u can get the system time,subtract it from initial time and set the bar percentage value proportionally...It will simulate a progress bar like scenario....
System time can be obtained by System.currentTimeMillis().
regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Roy,
let me give u an example:
long startTime = System.currentTimeMillis(); //line1
rs = pr.excuteQuery(); // line2
long stopTime = System.currentTimeMillis(); // line3
now u ll get the stopTime only after the the execution of line2 is complete, ie all the resultset is loaded. so now there is not use of the progress bar.
regards,
Piyush.
Roy,
Sadly, ProgressBar in WD is suitable for displaying some 'static' percent value rather then for real-time visualization of process' progress. The problem is in fact that separate HTTP request/response round-trip required to update values of UI element (incl. ProgressBar) and there is no way in HTTP to push-back content to browser.
Also you can do this but it is strictly unrecommended in J2EE application (due to use of multithreading):
1. In first request/response cycle (some WD action) you set up Timer UI control and fork new thread that perform loading of data.
2. In subsequent requests (as a result of Timer.onTimer action execution) you poll thread for progress via some variable shared between 2 threads and update progress bar accordingly
3. If on next timer invocation the work is done, you are navigating to result or populate context to show result or whatever. DO NOT MODIFY WD CONTEXT OR INVOKE CONTROLLERS METHODS FROM SEPARATE THREAD!
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Roy,
a progress bar can only be shown if the view gets refreshed periodically. when the resultset is being loaded the view will only be refreshed when the whole resultset is loaded and the method terminates.
or what you can do is make an extra Thread to load the resultset and show the progress bar using ProgressIndicator UIE and TimedTrigger UIE.
one more thing, in case of resultset i think there is no way to find the current status of the resultset. u can know the total no. of records in it.
regards,
Piyush.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.