Toggle to add item to list

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.

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

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

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

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.

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…

– 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 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
– 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.

2 Likes

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

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

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

Can you show how you currently have it setup?

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.

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

Trebuchet setup on the Company IDs.

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

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?

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

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.
1 Like

Beautiful, thank you so much :kissing:

1 Like

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