Countdown

Does anyone have code for countdown, or API?

A countdown timer? Onscreen?
Easy now! I made one this evening :slight_smile:

My use case: a person does a corona test and needs to wait 15 mins to be able to take a photo

  • so onscreen I want the countdown to appear after they have put drops onto the test cassette… and then have a button to continue once the time remaining is 0.

So one column - start time
Another column - the 15 min wait

Next - a math column - time photo taken (start) + the time to add on (I have mins, so need to convert)
= photo + (min/60/24)

Next - another math column - so have the countdown in mins to the deadline === (whentotakephoto - now) * 60 * 24

And then a nice template column to make it look pretty - x mins to wait

And I display that as text on my form… and the screen refreshes every 5 secs or so.

I then have an extra bit - before the countdown is done, the button is greyed out and is basically ‘waiting’ … and then when an if-the-else is set (countdown left = 0) then the button appears.

Magic :slight_smile:

2 Likes

This is as close as it gets, I believe Glide’s now time refreshes every 5-6 seconds or so. If Robert was looking for a true countdown timer then probably it’s a no go.

2 Likes

I had done some digging into the javascript that controls the existing Stopwatch component. I thought I had found a simple fix that I was going to tell Glide about to allow it to properly count down as well as count up without the ugly negatives, but the more I looked at the code, it appeared to me that it really needed a complete rewrite, so I gave up and moved on. I think to get a true realtime countdown timer, the stopwatch component either needs to be reworked by glide, or a person would have to incorporate an external timer in a webview component.

5 Likes

Se o cronômetro for através de API, ele necessita de java script para rodar?

I use timers all the time in my apps. And they update every minute. Use Google scripts for a timer, its easy and takes very little resources. One of my apps runs a 30 minute timer and when it ends rotates people to the bottom of the list, even allows them to pull themselves out early and the timer automatically restarts on its own as well. The timer even knows what time of day it is so if it is past time it wont start a timer til the following day. Hell, the timer even sends text notifications to people being sent to bottom of list after time is up as well as 1st, 2nd, and 3rd positions that got rotated into their new positions.

2 Likes

Onde que eu consigo esse scipt, você pode me ajudar?

@Roberto-Duarte I’m not sure which timer you are referring to. The built in glide stopwatch does use java, but it only counts up. It will count down if you set a date greater than the current date/time, but it looks horrible. However, you can create a simple count down timer in glide with some very simple date math. It works very well and does not require any script, but it won’t update every second like you may expect it to. At most, the count down value of the timer will update every 5 to 10 seconds. So it really depends on how precise you need the timer to be. If it’s every minute, that is very easy with a date column and a math column. If you need something that has to be precise to the second, then you may have to use a web view that points to another website that has a timer. It all depends on your needs.

3 Likes

Obrigado pela atenção, o cronômetro teria de ser com dia, horas e minutos, para fazer uma promoção de um produto, quando o cronômetro zerasse terminaria com a promoção, pressão psicológica para o usuário se sentir obrigado a comprar rsrsrs. :call_me_hand:

This should help you.

You can probably remove the part about seconds if you don’t need it. All you will need is column that contains a future date, then a math column to calculate the duration by subtracting Now from your date column. This will give you a duration in days. The rest of the column will split that in the proper Days, Hours, Minutes, and Seconds.

5 Likes