How to count the amount of related items?

Hello, I have a question and I would appreciate someone’s help, please.

I’m creating a project where I need to relate the items that a user needs with the items that other users have.

For example:

Albert needs: wood, nails, and hammer.

Joshua has: nails
Hebert has: hammer and wood
Anderson has: wood, nails, and hammer.

How can I make Albert see that Joshua has nails (1 item), Hebert has hammer and wood (2 items), and Anderson has wood, nails, and hammer (3 items)?

The columns with the separated items are already prepared, but I don’t know how to relate and enumerate how many and which items each of them has for the user Albert.

I smell some gamification happening here :slight_smile:

Albert’s “needs” need to be an array column. If Albert is selecting which items he needs from a choice component, then the result is a CSV of items. You need to split the CSV column using a split text column to form the array.

I imagine the other three users have items in an inventory table (one item per row)? Each user will have a multiple relation to their own items. Probably from the users table → inventory table. From that relation, create a lookup column so each user has an array of their inventory items.

Afterwards create a multiple relation from Albert’s needs column to this lookup column. Finally, add a rollup column that looks at this relation column to get a count of items that match.

4 Likes

Sure, :D, you always inspiring us.

I created a single column to put all the items that the user needs and has. From this, would it be possible to create some kind of relationship that identifies which users have the items that the other needs?

In the example in the image, Anderson needs wood, nails, and hammer, so I would like to know who has which items.

And thank you very much for your videos, I learn a lot and always with you.