Setting the progressbar value in a mobile app

Setting the progressbar value in a mobile app

  

Hi,

I'm working on the version 10 platform and enjoying it highly, but now stumbled upon a small problem. I have a screen in my mobile app where I synchronize some data, i like to show the progression to the user using a progress bar, but from code there is no way I can change the value of the progresssbar. Anuone has an idea hw to accomplish this ? 

regards,

Wim

Hi Wim,

Can you share an image or oml of your logic, so that I can help you with the best approach?

João Neves wrote:

Hi Wim,

Can you

 share an image or oml of your logic, so that I can help you with the best approach?

This is the screen, the loading boilers text is on the prgress bar

When pressing the button Start sync, i start connecting to the server to get my boilers and other stuff into the local client storage

I get the boilerlist using a rest call then load it to my local storage. In the assign I want to set the value of the progressbar to indicate how far the loading process is

First you have to create a local variable on your screen to store the progress. Then you have increment that variable's value as the progress of sync moves forward (on that assign). The trick here is to update the UI while this logic is running. To do that you will have to use a Javascript node with the following code:

$public.View.render($resolve);

But be careful and don't execute this JS Node very often as it will have significant performance impact and slow down the whole operation. I suggest that you do this once in a while (for instance for every 30 iterations or more - you'll have to tweak this).

For more information about this $public JS API check out here:

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/View

Have in mind that this is only available in platform version 10.0.200 or above.

It's back to the old days of windows programming ;-) fiddeling around with some java script isn't very nice but ok should be do-able, thx for the sollution, will try this out.

Solution

It turns out its sufficient to just link a screen variable to the progressbar, and updating this variable in the load process automatically will result in the progressbar moving without any java code

Solution

It might work but its guaranteed that the progress will be updated (rendered).

Wim van den Brink wrote:

It turns out its sufficient to just link a screen variable to the progressbar, and updating this variable in the load process automatically will result in the progressbar moving without any java code

Hi,

Can you please explain in detail ? I have created a local variable in my screen of Integer type. Now, how can I update its value according to the progress bar ?


The progressbar wil be updated when you change the value of the var, if that var is connected to the progressbar. It should be a value between 0 and 100.So drag a progressbar object to your screen, create a local var of type integer named ProgressVar, set progress parameter of the progressbar to ProgressVar. Now while processing for instance a list of records just set the value of ProgressVar to 

(i have a entity with messages I retrieve and process)

Trunc((GetMessages.myMessages.CurrentRowNumber / GetMessages.myMessages.Length) * 100)

this should work

Wim van den Brink wrote:

The progressbar wil be updated when you change the value of the var, if that var is connected to the progressbar. It should be a value between 0 and 100.So drag a progressbar object to your screen, create a local var of type integer named ProgressVar, set progress parameter of the progressbar to ProgressVar. Now while processing for instance a list of records just set the value of ProgressVar to 

(i have a entity with messages I retrieve and process)

Trunc((GetMessages.myMessages.CurrentRowNumber / GetMessages.myMessages.Length) * 100)

this should work

I have done the whole work. One problem I am having is while processing. Actually I am opening a pdf url on the screen so for that I need a Progress Bar. I have a variable of text type in which I am assigning the URL. So what should I pass in the ProgressVar ?


I don't think you can use a progressbar for that action, the processing is not done by your application but outside (loading of the pdf) so it's impossible for you to track the progress and knowing how far it is.

Wim van den Brink wrote:

I don't think you can use a progressbar for that action, the processing is not done by your application but outside (loading of the pdf) so it's impossible for you to track the progress and knowing how far it is.

The pdf is opening in the app only, not outside.