# Best way to remove prior purchases?

**URL:** <https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329>\
**Category:** Ask for Help\
**Created:** [October 19, 2020, 4:32pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329 "2020-10-19T16:32:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_Lichtenwalter](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/todd_lichtenwalter/32/12231_2.png) [@Todd\_Lichtenwalter](https://community.glideapps.com/u/Todd_Lichtenwalter)\
**Post date:** [October 19, 2020, 4:32pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329/1 "2020-10-19T16:32:51Z")

</div>

I have a classroom gaming app where students make purchases. In the event they “die” and must be revived, I am trying to figure a way to have their prior purchases not factor into new purchases total once they are “revived”. I could have the teacher admins go into the Google sheet, sort for that user and delete all prior rows containing their transactions but was hoping for a more elegant solution in-app. I made a choice component toggle 0-1 and when 0 then the previous purchases will no longer count toward energy balance but then I am stuck with future purchases not being able to count. Any ideas?

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [October 19, 2020, 4:55pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329/2 "2020-10-19T16:55:02Z")

</div>

I have achieved something similar by using sessions and linking the “purchases” to these. Then a session “dies” rather than a “purchase” if that makes sense. When a user dies, the current session “dies” do all of its purchases die with it. When the user “comes alive” again it’s via a new session and all subsequent purchases are attached to this rather than to the prior dead session.

---

<div class="post-metadata">

**Author:** ![Todd\_Lichtenwalter](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/todd_lichtenwalter/32/12231_2.png) [@Todd\_Lichtenwalter](https://community.glideapps.com/u/Todd_Lichtenwalter)\
**Post date:** [October 19, 2020, 5:09pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329/3 "2020-10-19T17:09:56Z")

</div>

Interesting solution: when the session ends, are they logging back in with the same username/email though? Trying to visualize your structure of sessions

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [October 19, 2020, 6:06pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329/4 "2020-10-19T18:06:59Z")

</div>

Yeah. The user is represented by the same row. When they login, if they have no current “live session” then they need to create one. Subsequent purchases are associated with this. So I would envisage a sessions sheet with a relation back to your user. In the user sheet they need a relation to their “current session” which will always be “alive”. When you submit a purchase, link it to both a user and their current session. The users purchase are then those associated with the user AND their current session.

---

<div class="post-metadata">

**Author:** ![Todd\_Lichtenwalter](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/todd_lichtenwalter/32/12231_2.png) [@Todd\_Lichtenwalter](https://community.glideapps.com/u/Todd_Lichtenwalter)\
**Post date:** [October 19, 2020, 6:42pm UTC](https://community.glideapps.com/t/best-way-to-remove-prior-purchases/17329/5 "2020-10-19T18:42:55Z")

</div>

Thanks, I will give it try.
