Choice component with multiple selection for many-to-many relationships

Hi Everyone,

I am new to Glide and I want to use Choice component to capture user’s multiple selection as it seems efficient and user-friendly. As I see it is entered to a single cell in Glide tables. The problem is that I want to enter the selections into a junction table to manage many-to-many relationships. As I understand multiple values in a single cell cannot be split and for the junction table I need separate rows for each selection. So I am not sure if Choice component can be used in my case.
I want users to be able to select multiple hobbies from a pre-defined list. Then the user can see other users with intersecting interest in hobbies (if having any of the hobbies in common).
What is the best way to approach this problem while keeping the selection options flexible/extendable and the selection process user-friendly?

Thanks for any guidance in advance.

You can split it. Use a Split Text column to split the comma delimited list of selections into an array. Then you can use the Split Text Array in a Relation column.

2 Likes

Thanks Jeff_Hager for the great tip. :+1: :medal_military:

1 Like

HI Jeff_Hager,

I think I am stuck again. How can I find the intersection of 2 arrays. I managed to create the Split Text Array, but now I realized that with logical if else I cannot compare User’s interest array with other users’ interest array, since contains does not work for intersections. Do you have another good tip for me?
Thanks again

Does either array contain duplicates?
If they don’t, you could do this in two steps.
Firstly, combine both into a single array. You can do that with either the Make Array column or the Append Array plugin. Then secondly, use the Duplicated Items plugin to find the duplicates in your combined array. The result of this will be the intersection of your two arrays.

3 Likes

Thanks Darren_Murphy,
I will try to follow the steps you recommended. The arrays don’t have duplicates fortunately. :smiley_cat:

Darren_Murphy that worked perfectly. Thanks for your help. :medal_military: :+1:

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