1223
Views
13
Comments
Solved
Auto Refresh web screen question
Question

I have a chart in a web screen that is currently refreshed manually by the user clicking a button that calls a screen action. The screen action refreshes an aggregate, and then does an ajax refresh. 

Is there an easy way to automate the refresh? Ideally, I would like to refresh every 3 minutes by programmatically calling the screen action I have created. I have tried using a timer, but the timer only allows server actions to be associated with it.

Thanks for the help!


2019-06-15 21-39-22
Afonso Carvalho
 
MVP
Solution

Hi Ryan,

If you're okay with small time differences, you could leave this to the browser javascript and use the setInterval function to periodically click on a hidden button and call your action. Check the espace for an example.

There's a hidden button on the page, and some javascript that clicks on it on the webscreen javascript property - the time is expressed in milliseconds, so this will cause the button to be clicked every second:

This is okay if all you're looking for is a simple periodical refresh, but you shouldn't use something like this if you need realtime refreshes or anything that requires precision.

AutomaticRefresh.oml
UserImage.jpg
Ashima Pahwa

Afonso Carvalho wrote:

Hi Ryan,

If you're okay with small time differences, you could leave this to the browser javascript and use the setInterval function to periodically click on a hidden button and call your action. Check the espace for an example.

There's a hidden button on the page, and some javascript that clicks on it on the webscreen javascript property - the time is expressed in milliseconds, so this will cause the button to be clicked every second:

This is okay if all you're looking for is a simple periodical refresh, but you shouldn't use something like this if you need realtime refreshes or anything that requires precision.


Hi Afonso,

I am trying to do auto refresh by add Javascript to webscreen :

setTimeout('window.location.reload();', 30000);

, its great. However, it seems it is actually clicking a button which sends emails so at every reload an email is sent. Any pointers are appreciated.


Best Regards,

Ashima


UserImage.jpg
Ryan Rigby

Thank you! This is exactly what I needed. 

UserImage.jpg
Ryan Rigby

I found a small problem with this solution...the screen only updates when the button is set to visible. If I set the button to not be visible the screen no longer refreshes. Does anyone have any insight as to why this might be the case?

2019-05-22 11-30-09
Marcelo Ferreira

Hi Ryan,

How are you hiding the button? It needs to be with css "display:none;". because if you use the button property the button is not even render on screen.

Regards,

Marcelo

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Make sure you are not setting the "Visible" property of the button. The naming of the property is a bit misleading, and if you set "Visible" to no, the button will not be included in HTML: this causes an error in Javascript.

Either create a class with CSS like "display: none;" or create a container around the button and set the "Display" property to False (the element will be included in HTML, but will not be visible).

UserImage.jpg
Ryan Rigby

Thank you Marcelo and Afonso. I was trying to hide the button using the 'visible' property of the button. I am now using CSS like you suggested and it works beautifully.

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

No problem! If you ever want to check why something goes wrong clientside, right click on a page, and look for a button that says Inspect or Console. The javascript error log will give you some clues that you can use to track down the issue.

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hi Ashima,

Not knowing what your page does, I'm guessing you have a button that sends emails there, and you've clicked it once before your auto refresh kicks in. 

I'm assuming what's happening is form resubmission - when you submit a form on a page and then refresh it manually, most modern browsers will warn you about this. There's two ways to avoid it here:

 - use an action that sends you to the same page instead of using location.reload() - something similar to what I wrote above;

 - have your email sending button send you to the same page instead of stopping with an End node.

In the future, consider opening a new post! Most users won't read old and answered posts, you'll be able to get more answers with a fresh post.

2021-03-10 13-50-58
NaveenRaj

Hello Guys,

                 I read all your messages. My question is, if we are reloading every 3 or 4 seconds, is this will not cause a performance issue?

2019-05-22 11-30-09
Marcelo Ferreira

Hi,

Yes this will cause performance problems if you do it every 3 or 4 seconds. But his requirement was every 3 minutes. What are you trying to accomplish?

Regards,

Marcelo

2021-03-10 13-50-58
NaveenRaj

Hi Marcelo Ferreira,

                               Thanks for the response. I have one scenario. In web, we are listing video call slot list. slot timings like 11 to 11.30 slot, 12 to 12.30 slot etc, in this web screen if we have 11 to  11.30 slot then we need to enable VideoCall button for 11 to 11.30 automatically. Kindly find the attachment for this. Looking for your response.


regards,

Naveen

VideoCallEnableButton.png
2019-05-22 11-30-09
Marcelo Ferreira

Hi,

Since you know the specific time that refresh needs to be done. You can set up a timer to refresh the screen at that specific time.

Regards,

Marcelo

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