# Best way to update inventory table with ordered items

**URL:** <https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656>\
**Category:** Ask for Help\
**Created:** [May 25, 2024, 8:08pm UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656 "2024-05-25T20:08:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 25, 2024, 8:08pm UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/1 "2024-05-25T20:08:12Z")

</div>

Hey guys!

I’ve created the image below, hopefully it helps.

Question: Is there a way to update the inventory table when the “shop owner” updates a cart to paid/delivered? (Currently just using the edit form component to change the status in the cart)

Or, when the customer confirms their cart?

I think I could work out a way to do it by adding all items that go to CartItems table to the inventory table in the same “action” but that seems clunky.

CartItems and cart are linked via a unique ID from User Profile.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/8/5864a8abe2f0a345fa3e65742ce3c88ec4b738b2.png)

Thanks.

---

<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:** [May 26, 2024, 1:31am UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/2 "2024-05-26T01:31:52Z")

</div>

I think you can use a relation & rollup from the Inventory table to the CartItems table and sum all the items where their cart status is Paid/Delivered?

You might want to have another table to track manual inventory updates as well that the owner can add to. Say I add 100 items of item A, or remove 50 items of item B, then that table will store such type of info.

Overally, your live inventory item will be calculated by Total items added manually - Total items paid - Total items removed manually.

---

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 27, 2024, 7:26pm UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/3 "2024-05-27T19:26:10Z")

</div>

Thanks for this!

How would I include the “filter/rule” if the status is paid?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/f/2f94e3bec6b6f046967fc5c735a6594b7dfafb0a.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:** [May 27, 2024, 9:18pm UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/4 "2024-05-27T21:18:09Z")

</div>

You can use a query instead of a relation if you need additional criteria.

---

<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:** [May 27, 2024, 11:35pm UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/5 "2024-05-27T23:35:24Z")

</div>

Here’s a docs link.

> **[Query Column | Glide Docs](https://www.glideapps.com/docs/query-column)**
>
> Create complex relations in your data with conditional filtering, sorting, and limits.

---

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 28, 2024, 6:36am UTC](https://community.glideapps.com/t/best-way-to-update-inventory-table-with-ordered-items/73656/6 "2024-05-28T06:36:18Z")

</div>

Epic thank you! This will be my first time testing out the Query Column
