Any ways to display progress of a data action on screen?
Application Type
Reactive
Service Studio Version
11.14.16 (Build 60354)
Platform Version
11.14.0 (Build 33133)

Hello! Is there any ways to tell number from server action(Data action) to client side(screen) in mid-execution(not only at the end of execution)?

I'm trying to make an screen which shows progress of its data action's execution and thus I'm looking for a way to send(output) number and/or text outside of server action in mid-execution so that the screen can display.


To be more specific, I'll explain the background of my screen.


The screen's data action fetches data about tens of thousands of records from external DB and process them for DataGrid. Since it takes minutes for the action to complete and data showing up on screen,  I'm trying to show progress(e.g. query completed/processing data etc...),, telling users that the app is making some progress even if it's very slow.

Otherwise users will be nervous since they can't tell it's still loading or broken and stuck.


What I tried was to separate the data action into pieces of server action put them inside client action (which is called on after fetch), and when each part of action is done, update variables which holds progress of the execution.

However, as I mentioned, I have to fetch huge number of records, so each time execution comes back to client side, those huge amount of records come to client side as well. It might be an impact to an performance and cause some other problems in my app. And moreover, as far as I remember, calling multiple server actions out of client action is not recommended by OutSystems' best practice.


Long story short:

I'm looking for a way to output progress of Data action with a lot of records, but separating the action into server actions and calling them from client action does not seem to be a good idea.


Please lend me your wisdom.

Tahnks in advance.

Hi Shinichiro Endo,

As Toine Tuerlings suggested, you can create an entity that will store the process log . Please see the sample entity model below.

Hi  Shinichiro Endo, 

In my case, the process runs on a timer and I had a button that was used to refresh the aggregate. If you want to refresh it automatically then you can make some javascript that will do the button clicking for you after every interval. Check the code below (it triggers click event after every 2 secs)

function myFunction(mybuttonId) {

  setInterval(

function(){ 

document.getElementById(mybuttonId).click() 

}, 2000);

}

You can place the script in the OnRender event and pass the button id there.

Please see if this works for you.

Thanks

I would advise to create a helper entity in which you store the progress that you want to present.

Hi Shinichiro Endo,

As Toine Tuerlings suggested, you can create an entity that will store the process log . Please see the sample entity model below.

Hi, Pranav and Toine.

Thank you for your suggestions.

I came up with similar idea, but the problem was I had no idea how to update the screen with updated entity.

What I want is to show users current status of data fetching(e.g. "fetching data..." -> "proocessing data..." -> "sorting data..." etc. like "In Process" in Pranav's example separated into 3 stages.), so those processes need to be displayed right after they've been updated.

(I don't know if that's helpful but here is a image of concept what I'm trying to show users.)

I guess refreshing aggregate every few seconds will do the job, but I feel that's not the smartest way to do it.

How can I achieve that in best-practice way?


Best regards.

Shinichiro Endo

Hi  Shinichiro Endo, 

In my case, the process runs on a timer and I had a button that was used to refresh the aggregate. If you want to refresh it automatically then you can make some javascript that will do the button clicking for you after every interval. Check the code below (it triggers click event after every 2 secs)

function myFunction(mybuttonId) {

  setInterval(

function(){ 

document.getElementById(mybuttonId).click() 

}, 2000);

}

You can place the script in the OnRender event and pass the button id there.

Please see if this works for you.

Thanks

Hello Pranav Pandey,


Thank you so much for your quick response and suggestions.

It was very clear and easy to understand.

I believe this is the most reasonable way to achieve my goal in OutSystems, and will try it in my app.


Again, I really appreciate your quick and helpful suggestion.

And thank you so much for Toine Tuerlings' response too.



Best Regards.

Shinichiro Endo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.