# Displaying new objects with a switch

**URL:** <https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799>\
**Category:** Ask for Help\
**Created:** [February 21, 2022, 8:40pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799 "2022-02-21T20:40:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickP](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nickp/32/37966_2.png) [@NickP](https://community.glideapps.com/u/NickP)\
**Post date:** [February 21, 2022, 8:40pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/1 "2022-02-21T20:40:22Z")

</div>

Hello.  
I’m designing a real estate service.  
I would like to display only new objects for say a week using a switch.  
Is it possible to implement this?  
I can’t set up such a condition on my own.  
How to work ? Through if the else or by some other parameters?

---

<div class="post-metadata">

**Author:** ![Cloud\_X](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cloud_x/32/11700_2.png) [@Cloud\_X](https://community.glideapps.com/u/Cloud_X)\
**Post date:** [February 21, 2022, 9:05pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/2 "2022-02-21T21:05:44Z")

</div>

can you explain to me what do you mean by (say a week)

---

<div class="post-metadata">

**Author:** ![NickP](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nickp/32/37966_2.png) [@NickP](https://community.glideapps.com/u/NickP)\
**Post date:** [February 21, 2022, 9:34pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/3 "2022-02-21T21:34:29Z")

</div>

Displays cards for the last 7 days.  
Those that were added earlier will not get into the filter. Only the latest ones from the last 7 days.

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [February 21, 2022, 9:54pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/4 "2022-02-21T21:54:54Z")

</div>

Easy to do:

Let’s say you have Timestamp as a date column

You need a math column - I’d call it mth-timestamp  
And your formula it t + 7  
With t being your timestamp  
And 7 is days (1/24 is an hour, etc)

Then your inline list just needs a filter - show if the show until date is after ‘now’ (a glide thing that appears when you can use now)

Good luck!

---

<div class="post-metadata">

**Author:** ![NickP](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nickp/32/37966_2.png) [@NickP](https://community.glideapps.com/u/NickP)\
**Post date:** [February 21, 2022, 10:22pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/5 "2022-02-21T22:22:05Z")

</div>

@Mark_Turrell Can you tell me how to make timestamp a data source in switch?  
Is it like this?

 ![Screenshot_105](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/1/c1416da3119133240269bee337b894b4b8c3dd1c.png)  
 ![Screenshot_106](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/b/6b1839a7825b912f7c32435f03f06c46c6aa4d85.png)  
 ![Screenshot_107](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/1/a1784281c3419f8bfbeea51548f50ad6ba9d1d53.png)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 22, 2022, 1:14am UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/6 "2022-02-22T01:14:10Z")

</div>

What is the switch supposed to do when you turn it on? Is it supposed to set a timestamp? Or is it supposed to be part of an additional filter to make that item show up? For example, if the item is created today with a timestamp of today, then the timestamp +7 as well as the switch needs to be on for the item to show in a list? Sorry, it’s not clear to me what the purpose of the switch is.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 22, 2022, 1:14am UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/7 "2022-02-22T01:14:54Z")

</div>

It only makes sense if it’s to turn on/off the “last 7 days” mode.

Say if you turn it on, show only items in the last 7 days.

If it’s off, show all items.

---

<div class="post-metadata">

**Author:** ![NickP](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nickp/32/37966_2.png) [@NickP](https://community.glideapps.com/u/NickP)\
**Post date:** [February 22, 2022, 10:18am UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/8 "2022-02-22T10:18:13Z")

</div>

Yes, you are right.  
So far I haven’t been able to set up such a display.  
Perhaps I am doing something wrong.  
Please look at the skinshorts and give advice.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 22, 2022, 2:19pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/9 "2022-02-22T14:19:37Z")

</div>

First, you can have a math column to calculate a “time comparison” value. The formula would be:

T + 7 with T being the timestamp when your user submitted the object.

If T + 7 is after now, it means the object is “new”. Else it is “old”.

Next, about your “switch”. I assume only admins can access that switch, and that switch’s value is global (not user-specific).

You can have a table with a single row to store the value of that switch, then cast that to the objects table.

Finally, the visibility of each item will be determined by an If Then Else column.

If switch is not true then true (no limit on new or old objects)  
If “time comparison” is before now then return null (limit to show only new objects, and objects that are old can’t be shown)  
Else return true.

Show only objects that have the returned value being true.

---

<div class="post-metadata">

**Author:** ![NickP](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nickp/32/37966_2.png) [@NickP](https://community.glideapps.com/u/NickP)\
**Post date:** [February 22, 2022, 7:11pm UTC](https://community.glideapps.com/t/displaying-new-objects-with-a-switch/38799/10 "2022-02-22T19:11:59Z")

</div>

Thank you very much. I will try to implement it.
