Hi all
I need to refresh a page on my application, let say, every 5 seconds. I am looking at timers but it doesn't seem to be an option to do that.
I found this old post (2016 and for OutSystems 10) https://www.outsystems.com/forums/discussion/20770/mobile-screen-refresh-on-timer/
but I don't think it applies anymore.
Any suggestion appreciated.
Thanks!
Hi,
You can use this forge component. It has an action called RefreshScreen that is a web block, that you just need to drag to your screen and choose the refresh interval.
Let me know if this helps,
Pedro
I did a search in the OutSystems forums and came up with some solutions:https://www.outsystems.com/forums/discussion/50537/auto-refresh-web-screen-question/
https://www.outsystems.com/forums/discussion/60783/how-to-refresh-screen-of-reactive-app/
etc, etc
I'm sure you find some solution overthere
We do this a lot and use the following approach. This way the data is only refreshed 5 seconds after the last fetch of data was complete so if there are any slow queries you don't need to worry about lots of flashing/updating of data on the screen.
Let me know if this helps or any questions
Hi Adam,
I wanted to give a go to your solution, but something is not right. I attach the oml file of a sample application. Can you please tell me what I have done wrong?
Thanks for your help.
Hi @Adam Elleston ,
i see 2 problems with this approach :
Dorine
Hello
You can refer to the below Forge Components -
ThanksTousif Khan
Hey,
First a script in the script section of interface tab. Use the below JS.
Then use script1 in Screen that you want to refresh.
Hope this might help you
Thanks & Regards,
Sudip Pal
You can also use the Timing Events forge component. This component contains 2 blocks (Interval and Timeout) that will trigger on your conditions. The biggest advantages of this component is that both widgets can be turned on and off via an Boolean so you can configure when the timer starts running or when it stops running.
But although this refresh sounds nice please also consider the performance implications. If you have enough screens open that refresh itself you can DDOS your own environment pretty quickly by overloading your SQL database. Make sure that you protect yourself against this by;
Hope this helps,
Vincent
Hello Domineco,
You can refer this post for solution I provided:
https://www.outsystems.com/forums/discussion/90561/how-to-make-push-notifications-based-on-regular-every-5-minutes-get-api-request/
Regards,
Sanjay
When using setTimeout or setInterval via javascript, don't forget to clear them using clearTimeout or clearInterval in the OnDestroy event.https://success.outsystems.com/documentation/11/developing_an_application/implement_application_logic/screen_and_block_lifecycle_events/#on-destroy