# Using "if-then-else" for visibility

**URL:** <https://community.glideapps.com/t/using-if-then-else-for-visibility/62225>\
**Category:** Ask for Help\
**Created:** [May 29, 2023, 9:36am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225 "2023-05-29T09:36:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 9:36am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/1 "2023-05-29T09:36:42Z")

</div>

Hey fellow Gliders,

I am not sure whether there is something wrong with my logic or what but I am losing my mind over this.

I have a “Now” column with gives the current time.  
I have a button that I want to hide based on the time interval for example I want the button to show between 08:00 - 08:30.  
I have 2 column with 08:00 as opening time and 08:30 as closing time.  
Now the logic I went for is the following:

If “Now” is before 08:00 = false  
If “Now” is after 08:30 = false  
Else = true

The expected behaviour is that the column will be checked to show true when the time is 08:00 - 08:30 and this will result in the button being visible since I have the condition on the button to show when “if-then-else” column is checked.  
What am I missing here?

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 29, 2023, 9:39am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/2 "2023-05-29T09:39:06Z")

</div>

What is the whole date for your time columns? You are comparing to NOW. which is a date and time

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 9:42am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/3 "2023-05-29T09:42:42Z")

</div>

So even if I chose the column to show “time only”? You can’t just relate it to time?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 29, 2023, 9:43am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/4 "2023-05-29T09:43:16Z")

</div>

- Create a Math column using the following:

```auto
Hour(Now)+(Minute(Now)/60)

```

- Now, for your if-then-else column, use:  
– If math column is less than 8, then null  
– If math column is greater than 8.5, then null  
– Else `true`

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 9:44am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/5 "2023-05-29T09:44:50Z")

</div>

Let me try this one. Thanks Darren…  
Will this work regardless of the date?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 29, 2023, 9:45am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/6 "2023-05-29T09:45:01Z")

</div>

Yes. It will be true for 30 minutes every day, between 8am and 8:30am.

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 9:45am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/7 "2023-05-29T09:45:32Z")

</div>

Thanks. Let me get to it.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 29, 2023, 9:47am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/8 "2023-05-29T09:47:35Z")

</div>

Yep… it is a full date… you need to extract just time, as @Darren_Murphy shows you. Keep in mind that other users might be in a different time zone… then Darren’s method might not be good for you 😉 you can convert your time zone to the user’s time… then extract just time

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 9:49am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/9 "2023-05-29T09:49:44Z")

</div>

Thanks @Uzo, I am on it already.  
I learn something new everyday with Glide.

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 10:16am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/10 "2023-05-29T10:16:23Z")

</div>

I think there must be a bug or something then because its not giving me the result i expect. The if then else column is showing “false” even though i can see it for myself that the value in “now” is within the parameters. This is supposed to be true for 12:00 and 12:30

“Now” Column construction:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/f/ef3e1b18e0f3a90eedc123c9313e71c55b75246d.png)

If then else column construction:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/7/e74ea8bbdb144490603a24fb4b2a8076312b6f9a.png)

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 29, 2023, 10:18am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/11 "2023-05-29T10:18:40Z")

</div>

`>!` wrong

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 29, 2023, 10:19am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/12 "2023-05-29T10:19:10Z")

</div>

The problem is below:

 ![CleanShot 2023-05-29 at 18.17.09@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/5/b5fd7fdd90edd75c353b28c256365c8a7c116190.png)

That should be greater than, not less than.  
Also, it’s not necessary to explicitly return false for the first two conditions. You could just leave those empty.

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 10:21am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/13 "2023-05-29T10:21:28Z")

</div>

😂😂…Okay…that’s it, I am taking a walk. I have been at this for a while now. It’s break time…

Thank you so much @Darren_Murphy and @Uzo for chipping in…  
I am sorted now 🤗

---

<div class="post-metadata">

**Author:** ![Luther](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luther/32/17929_2.png) [@Luther](https://community.glideapps.com/u/Luther)\
**Post date:** [May 29, 2023, 10:49am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/14 "2023-05-29T10:49:35Z")

</div>

This method saves me columns. I don’t have to have a column for “start time” and “closing time” and therefore this is less labour intensive.  
Thanks once more Darren. I wish I had asked for help sooner 😔…

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [May 30, 2023, 10:50am UTC](https://community.glideapps.com/t/using-if-then-else-for-visibility/62225/15 "2023-05-30T10:50:12Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
