1

I have to implement a progressbar that show the progress of a report generation, the problem is that i have to represent the percentage of the report progression based on event generated by the generation but without first knowing the total amount of event, so for example the report generation sends the following event(phase) :

 - Starting Report generation
 - Start Query execution
 - End Query execution
 - Start Report Rendering
 - End Report Rendering
 - End Report Generation

In this example there are in total 3 task and 6 events, i don't know the total number of task but i know that the total number of events is twice respect the number of tasks.

I don't know which events are present and how many they are , but i have to represent the progression with a progress bar so with a number between 0 and 100 .

How can it be calculated ? Whats the best way to represents the progression ?

aleroot
  • 71,077
  • 30
  • 176
  • 213
  • 2
    So you basically know nothing and want to get the progress percentage. Do you really understand the use of progress bar? It implies you already know something – Adel Boutros Jan 18 '12 at 10:00
  • Maybe with some math formula you can represent the progression, i know that is not simple, but if it was easy I would not have asked here on StackOverflow ... :) – aleroot Jan 18 '12 at 10:03
  • You can't. what if you have 10 events? what if you have 12 events? To use the the progress bar, you need a deterministic number not something arbitrary. – Adel Boutros Jan 18 '12 at 10:26
  • Keep in mind that i don't want the exact value of the progression, but only an approximate value, like an heuristic determination ... – aleroot Jan 18 '12 at 10:30
  • 1
    If you won't have more than let's say 50 events, then set the maximum to 50 and for each event done, the progress would be numberEventsDone/50. But you're final event will fill most of the progress bar. Nevertheless, it still gives an idea about progress – Adel Boutros Jan 18 '12 at 11:03

2 Answers2

3

Probably the best you can do is to abandon the idea of actual progress bar altogether, and sue some indeterminate progress indicator instead. A "marquee" or "bouncing" progress bar is typically used in this scenario on desktop systems.

Another option - if you really want to show something progress-like - is to employ some heuristics and just (partially) fake it. You don't really have many information here so it would have to be pretty clever, and require a lot of testing on real cases. Here's some suggestions:

  • Increase the progress based on the nesting level of currently processed task. Basically, the idea is that the more fine grained the task is, the less it contributes to the overall progress. By task nesting I mean, of course, the hierarchy implied from bracketing of your Start and End messages.

  • Get a reasonable estimate of the maximum number of tasks you can expect, and adjust the speed of progress' increase based on how close you might be to finishing. For example, if you expect no more than 500 tasks, and you have processed 300 but are already displaying 80% progress, you must seriously slow down any further increase. Similarly, if you are lagging behind, you should appropriate scale up you progress increments.

  • Avoid big jumps. Even if you need to rapidly catch up, as described in previous point, do so gradually and over time. To put up a concrete example: rather than incrementing once by 10% and then stand still for 10 seconds, make 10 increments of 1% each over the course of 10 seconds.

There are probably many more techniques you could try to use. Overally, it's quite an interesting UX- and math-related problem, but you should consider whether spending cognitive effort on it is worth the hassle. I expect that in most cases, the indeterminate progress would be absolutely fine.

Xion
  • 22,400
  • 10
  • 55
  • 79
1

What you require is not possible with a normal progress bar since you basically have no clue of the progress which you are trying to track down. What you can do is to have a marquee progress bar (a progress bar which keeps going indefinitely) to show the user that your application is still going and above or below it, have a non editable text box which dhows the tasks you have mentioned above.

npinti
  • 51,780
  • 5
  • 72
  • 96
  • So you are saying that it is impossible to calculate a percentage of progression if you don't know first the total number of tasks ? – aleroot Jan 18 '12 at 10:06
  • 2
    @aleroot The way I see it yes... it is like you want to do something like 100/x = some concrete value and x is not know... I do not think that that can be done. What you can do maybe is to come up with some sort of worst case scenario where the amount of tasks can't be higher and you always you that. So if in your worst case scenario the amount of tasks is 8, and you are sure it can never go over 8, you can use that value to track the overall progress. – npinti Jan 18 '12 at 10:09