# Toggle to add item to list

**URL:** https://community.glideapps.com/t/toggle-to-add-item-to-list/56314
**Category:** Ask for Help
**Created:** [January 4, 2023, 9:43am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314 "2023-01-04T09:43:00Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 9:43am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/1 "2023-01-04T09:43:00Z")

</div>

Hey there,

I want to enable my users to browse a list of items (Companies) and hit Toggle on to add them to their list of ‘Dream companies’. How might I do this?

I want that list of selections they’ve made then to be viewable through a collection on their user profile screen.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [January 4, 2023, 9:45am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/2 "2023-01-04T09:45:33Z")

</div>

if they’re sing-in users… add the row ID of the company to the array column in their User profile table (append array)

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 9:48am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/3 "2023-01-04T09:48:30Z")

</div>

So I need to make a button that adds company names to an Array column on the user profile? As before I had users having row ID’s

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [January 4, 2023, 9:49am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/4 "2023-01-04T09:49:50Z")

</div>

not company’s names… their row IDs… you can use lookup column to find names.

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 10:11am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/5 "2023-01-04T10:11:06Z")

</div>

Naw really confused. Not working. I think the issue may be the buttons, as it is seemingly only letting me edit ‘this item’ so it just keeps overwriting the list collection, and not adding to the user specific column.

---

<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: [January 4, 2023, 10:13am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/6 "2023-01-04T10:13:45Z")

</div>

You basically have two choices. An easy way, and a not so easy way. The easy way will get you exactly what you want, but could eat into your row count very quickly. The not so easy way will minimise your row count, but will be harder to implement.

- The easy way:  
– Create a UserLists table, with columns for UserID and CompanyID.  
– When a user adds a company to their “List”, add a row to this table  
– When a user wants to remove a company from their list, delete the associated row  
– To use in a collection, just target the table and filter by UserID.

- The not so easy way:  
– Add a column to your Users table, and populate it with a joined list of CompanyIDs  
– When a user adds a company to their list, add the associated CompanyID to the list.  
– When they remove a company, do the opposite.  
– A really easy way to allow users to add/remove companies to their list would be with a choice component in multi-select mode.  
– but…

> [@kickso](#):
>
> I want to enable my users to browse a list of items (Companies) and hit Toggle on to add them to their list of ‘Dream companies’. How might I do this?

– this suggests that you want users to be able to add a company to their list whilst viewing the company details screen. So to do that, you’d need to use the [trebuchet](https://community.glideapps.com/t/the-trebuchet-method/48325) method.  
– ~~when it comes to displaying the company list in a collection, you would need to dynamically transform the joined list into a vertical list. For this, you’d need to use the “[Miracle Method](https://community.glideapps.com/t/transpose-columns-to-an-inline-list-the-miracle-method/32766)”~~  
– actually, I mis-spoke above. I was thinking of something else. To display in a collection, all you’d need to do is create an array of companyIDs using a split text column, then relate that to your Companies table, and use the relation as the source of the collection.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [January 4, 2023, 10:16am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/7 "2023-01-04T10:16:39Z")

</div>

I would use the super miracle method… create a JSON template and let Java take care of it… 😉

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 10:22am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/8 "2023-01-04T10:22:32Z")

</div>

Thanks this helps a lot. Going to watch that video and report back 🙂

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 11:13am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/9 "2023-01-04T11:13:16Z")

</div>

I think im nearly there - any advice on getting the collections to display properly? I am getting the user instead of the item showing up

---

<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: [January 4, 2023, 11:17am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/10 "2023-01-04T11:17:31Z")

</div>

Can you show how you currently have it setup?

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 11:18am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/11 "2023-01-04T11:18:41Z")

</div>

Is there a way for me to share with you securely?

Trebuchet is on the company ID level, not the user. User IDs are added/removed there.

---

<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: [January 4, 2023, 11:19am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/12 "2023-01-04T11:19:54Z")

</div>

Just some screen shots should be good enough. If there is confidential data showing, you can either redact it or send to me privately.

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 11:21am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/13 "2023-01-04T11:21:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/0/d0f1c8039e312d1493ffabc527b452581bc98155.png)

Trebuchet setup on the Company IDs.

When I add collection to user profile, it shows the user and not the company.

---

<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: [January 4, 2023, 11:24am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/14 "2023-01-04T11:24:15Z")

</div>

That’s in your Companies table, yes?

Where and how do you want the collection displayed?  
My understanding is that you wanted each user to see their own list, presumably on their profile page?

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 11:25am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/15 "2023-01-04T11:25:14Z")

</div>

yep configured on company side. I want the collection displayed on a dashboard/user profile.

---

<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: [January 4, 2023, 11:27am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/16 "2023-01-04T11:27:17Z")

</div>

Okay, got it.

So what you need to do:

- Use a split text column in your Companies table to create an array from your joined list of UserIDs
- In your Users table, create a multiple relation column that matches UserID to the array column in your Companies table.
- Use that relation as the source for your Collection.

---

<div class="post-metadata">

### Author: ![kickso](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@kickso](https://community.glideapps.com/u/kickso)
#### Post date: [January 4, 2023, 11:41am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/17 "2023-01-04T11:41:35Z")

</div>

Beautiful, thank you so much 😗

---

<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: [January 5, 2023, 11:42am UTC](https://community.glideapps.com/t/toggle-to-add-item-to-list/56314/18 "2023-01-05T11:42:26Z")

</div>

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