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.