# Visibility

Hi!
Does anyone know how to set a components visibility based on time? I want a component to disappear after a certain time, like a deadline.

If you have a datetime column, you can set visibility for it to only appear if datetime is after now.

1 Like

yes there is filter for time
like on or after

1 Like

HI @Calle_Ehrnberg,
1.Create math coloumn called current time, type n in formula, then in replacements box select n as NOW, this should give the current time.
2. Create another math coloumn called current time+whatever time limit you want to set. In this math column give the formula as c+0.0035, where c is current time match coloumn(note: time is displayed in days, so if you want to set 5 mins timer it will be 0.0035, 1 days = 1440mins, 1/1440*5 = 0.0035)
3. Once you setup the above 2 math coloums, you need to create final math coloumn, this will be the timer. formula will be ct5-c, where ct5 is currenttime+5mins math coloumn and c is the currentitme math coloumn. This will give a 5 min timer.
4. Then in your app view, go to visibility tab and set the visibility to show if the timer is greater than 0.

Note: you can also use the same steps if you have a predifened date, say event start date or somthing, just replace current time coloumn with that date.

Feel free to ask any questions, more than happy to help over a zoom call if needed.

3 Likes

Doesnâ€™t your formula make the 3rd column always return 5 minutes as the â€śnowâ€ť updates? I think what you would need is the timestamp of when the post is created, ideally by a form at her side, then you do from step 2 forward so the 1st column is static.

1 Like

Yes @ThinhDinh my suggested solution is a set 5 min timer, as i suggested in note: she can have a predefined timer as well, like u suggested static timestamp, also can be done

1 Like

I think what @ThinhDinh is getting at is that if you have your ct+5 column adding 5 minutes to current time, you will always be chasing it because ct+5 will be dynamically updating every few seconds and you will never meet or exceed that time. Instead you need to have a static time to compare to now.

I guess for a 5 minute timer, I would first capture the current datetime as a static value through an entry, edit, or form screen. Take that static time and add 0.0035. then the visibility condition can simply check if the calculated date time is on or after now.

3 Likes

Thank you very much all of you!! For this case I found ThinhDinhs solution the best solution but Im very glad for all the comments! You guys are great! Im just in the beginning of learning to understand and use Glide so chances are big we will se each other in this forum soon again when I need help, hehe!

2 Likes