# Adding to/ subtracting from an array

**URL:** https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468
**Category:** Ask for Help
**Created:** [June 5, 2023, 4:48pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468 "2023-06-05T16:48:21Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 5, 2023, 4:48pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/1 "2023-06-05T16:48:22Z")

</div>

I have a Users Table and a Books table. When a user selects a book an entry is created in the Books table with title and username. I would also like to add the title to an array in the user’s profile, so as a user selects and deletes titles the titles are added to or subtracted from the array.

Any direction on this would be appreciated.

---

<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: [June 5, 2023, 4:51pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/2 "2023-06-05T16:51:13Z")

</div>

If the Books table has a username, then you should be able to create a multiple Relation linking the user table to the books table. Then create a Lookup column that uses the relation. That will be your array.

---

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 5, 2023, 5:14pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/3 "2023-06-05T17:14:27Z")

</div>

Thank you

---

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 5, 2023, 10:08pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/4 "2023-06-05T22:08:36Z")

</div>

Problem I now have is that when I use the relation for a collection, it always shows the first row, no matter which user I am viewing as. Everything looks good in the users table (relation column has the correct data), but the collection list using the relation just does not move off the first row. Any ideas are welcome.

---

<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: [June 5, 2023, 10:24pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/5 "2023-06-05T22:24:33Z")

</div>

Either your relation is not configured correctly, or you are not using the relation as the source of your collection. Would have to see how you have everything configured to say for sure.

---

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 5, 2023, 11:21pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/6 "2023-06-05T23:21:09Z")

</div>

![Screen Shot 2023-06-05 at 4.19.56 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/3/43fe39e7abc1f32da722b76aca40476eba1161ed.jpeg)  
 ![Screen Shot 2023-06-05 at 4.20.08 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/e/1e1c59e3c445f5dbff19a51772aecdf4e9eabd78.jpeg)  
See if this helps

---

<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: [June 5, 2023, 11:35pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/7 "2023-06-05T23:35:27Z")

</div>

I don’t see anything wrong there yet. How is the collection set up? What exactly do you mean when you say that “it always shows the first row, no matter which user I am viewing as”?

---

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 6, 2023, 12:11am UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/8 "2023-06-06T00:11:50Z")

</div>

If I am signed in as the user in row 1, the collection shows the the four names in allbooksUsers. Same four show up if I am signed in as the user in row 2, row 3, etc.

---

<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: [June 6, 2023, 12:15am UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/9 "2023-06-06T00:15:25Z")

</div>

Do you have any filters for your tab? It should be filtered to something like “email is signed-in user”.

---

<div class="post-metadata">

### Author: ![George\_Pillari](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_pillari/32/55971_2.png) [@George\_Pillari](https://community.glideapps.com/u/George_Pillari)
#### Post date: [June 6, 2023, 1:25pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/10 "2023-06-06T13:25:36Z")

</div>

Resolved. I was launching the collections page on a standalone basis. Once I added a button from the user profile screen, the collection picked up the correct row.

Thank you all.

---

<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: [June 7, 2023, 1:26pm UTC](https://community.glideapps.com/t/adding-to-subtracting-from-an-array/62468/11 "2023-06-07T13:26:29Z")

</div>

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