Hi, I have a relative time and I noticed that it doesn’t refresh until the page is refreshed.
How can I program the page to refresh every 10 min for example? Or how can I make the relative time be up to date?
Thanks
Hi, I have a relative time and I noticed that it doesn’t refresh until the page is refreshed.
How can I program the page to refresh every 10 min for example? Or how can I make the relative time be up to date?
Thanks
How I would do this:
First, click on the advanced icon (the one with with >_) and press “show advanced informations”. If it says “hide” you’re already in good shape.
Second, create a workflow from the “cans” icon at the top that you want to run that would update, say, the relative time, by doing the date math and updating the appropriate. Give it an a name and click on that weird long ID on the upper-left to copy it to your clipboard.
Third, create a workflow to run on, say, page load. Give it one action - a custom javascript. You can add the code
if(!window.myInterval){
window.myInterval = setInterval(()=>{
wwlib.executeWorkflow('myworkflowid');
}, 10000);
}
Then highlight “myworkflowid” and replace it with the ID you just copied.
That should trigger your workflow to run every 10 seconds (10,000 milliseconds).
There are more advanced techniques, but this can get you started.
We work on these kinds of “hardest 5%” edge cases every day in State Change daily office hours and discussions. We have a number of weweb members (and others working on more advanced no-code applications) who get help with just the hard bits.
(You could also force the page to refresh every 10m using a variant of the above, but I think you have an opportunity for a much better/more elegant user experience through updating variables without a full reload)
Hi @Ewerton
Can you tell us a bit more about your use case? What elements and/or formulas did you use to create that relative time?
Hello @Joyce
I used this formula. I can’t use the date plugin because I’m using the 4 plugin limit in my plan.
return luxon.DateTime.fromISO(dataISO).toRelative()
I have a public task control page and the goal is to show everyone their progress in real time. The relative time is to indicate how long ago someone finished it. The page works fine, but the relative time is static until it is refreshed again…
I thought about making it update every 10 minutes
Hello @convés
Very grateful for your help. I’ll try to do it, but my technical knowledge is small in codes.
I’ll give it a try and see what comes out.
Greetings
Bringing in a little code can add magnitudes of power to your app. Starting with something like chatGPT or the weweb copilot can get you started. We also discuss it routinely in our State Change office hours and forums where we work on the hardest 5% of no-code projects.
Dude. I use chatGPt so much for my coding tasks. “Clean this up”, “comment my/their code snippet”, “write a function that does x”, “what does this error mean in the context of the code that throw the error” etc
ChatGPT had been hand holding with me as I get geared up with supabase and it’s sql functions, db triggers, etc.
It’s not the most helpful for supabase but I’ve found plenty of use cases for support.
Got it! Thanks for the feedback. Just passed it on to the team as we’re always trying to improve the pricing / plugin count structure.
Just gave you early access to WeWeb Copilot so you can play around with it as Ray and Jared suggested
wow . Very happy here for this. I noticed the presence and will definitely test it.
I will be very honored to demonstrate my system to you soon. He’s almost ready.
Thanks
Hey guys. I bring you the solution I got from ChatGpt.
Copilot weweb in this case did not solve it. But it has been of great help for other issues.
I hope this solution also helps someone. Hugs
Hi Raydeck,
I have tried to execute a setInterval following your instructions.
if(!window.myInterval){
window.myInterval = setInterval(()=>{
wwlib.executeWorkflow(‘myworkflowid’);
}, 10000);
}
I have the following error showing up in my console.
“Uncaught ReferenceError: wwlib is not defined”
I couldn’t find any information related how to fix wwlib.
Thanks!!
@AnthonyA - capital ‘L’ will probably resolve that. ie. wwLib.executeWorkflow(‘myworkflowid’);
Thank you Michael!
It was in fact a capital ‘L’.