How to create a user configurable autorefresh data functionality using Site property?
Application Type
Reactive

I want to create a user configurable auto refresh page data for 30 sec using site properties. So, how to do it? means how can a user autorefresh a page data according to his set time interval.

Thanks Pankaj, Its working swiftly and as per the requirement. I will mark this as a solution

Hi @Aditya Chinchole,

You can do this with the help of the javascript setInterval() function. 

You can set the interval in the OnIntialize() event of the screen which will call a client action and that client action will refresh your data fetch actions.

I have attached the OML file for your reference.

Please do not forgot to clear the interval in OnDestroy() event.

AutoRefresh.oml

Hi Pankaj, thankyou for ur effort. But, this code is hardcoded, like u have defined 30 sec interval which cannot be changed for a particular user. According to my requirement, I want that interval to be dynamic that is user configurable one, using site property.

you cannot use a site property for that.
the value of the site property will be the same for the whole environment/ tenant
all users in there would be getting the same value..

If thats your goal you need to create a table yourself to store the user id and the configured ammount of time..

then you can use the approach pankaj mentioned where he hardcoded the 30 seconds you need to look at your data and fetch the value the user configured..


Please keep in mind that in the beginning the user may not have set any value.. so you need to use a default value in case there is no value defined for a particular user

Hope this helps

Carlos Rocha

Thanks @Carlos Rocha, Can u plz send me a oml file as per your approach, for my better understanding..

I've chnaged Pankaj oml to get config from the database and to use a default value (30s) in case there is no config

AutoRefresh.oml

Hi @Aditya Chinchole 

I have done some changes in the application to make it dynamic. Now I am fetching the interval time form site property. 

Please see attached OML.

Hope it helps you.

AutoRefresh.oml

Thanks Pankaj, Its working swiftly and as per the requirement. I will mark this as a solution

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