# Script to change state

**URL:** <https://community.glideapps.com/t/script-to-change-state/25238>\
**Category:** Ask for Help\
**Created:** [April 7, 2021, 4:52am UTC](https://community.glideapps.com/t/script-to-change-state/25238 "2021-04-07T04:52:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis\_Siles](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luis_siles/32/9384_2.png) [@Luis\_Siles](https://community.glideapps.com/u/Luis_Siles)\
**Post date:** [April 7, 2021, 4:52am UTC](https://community.glideapps.com/t/script-to-change-state/25238/1 "2021-04-07T04:52:56Z")

</div>

I need to change the state of a row automatically. For example, I make a reservation, my row changes to reserved, and after 24 hours it should change to free again. How can I do with glide?

---

<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:** [April 7, 2021, 5:31am UTC](https://community.glideapps.com/t/script-to-change-state/25238/2 "2021-04-07T05:31:38Z")

</div>

Glide doesn’t support this natively, but there are ways to get the desired behaviour. You could try something like this:

- Create an extra date time column, call it something like “Reserved At”
- When a reservation is made, set that column to the current time (Now)
- Create a math column, call it something like “Reservation Expiry Time”. The formula will be `RA+1`, where RA is the Reservation Time
- Now use an if-then-else column to determine the status.
  - If Expiry Time is after Now, then Reserved
  - Else Available

---

<div class="post-metadata">

**Author:** ![Luis\_Siles](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luis_siles/32/9384_2.png) [@Luis\_Siles](https://community.glideapps.com/u/Luis_Siles)\
**Post date:** [April 8, 2021, 4:59am UTC](https://community.glideapps.com/t/script-to-change-state/25238/3 "2021-04-08T04:59:05Z")

</div>

Ok, let me check. Thanks
