# Issue with many to many

**URL:** <https://community.glideapps.com/t/issue-with-many-to-many/76177>\
**Category:** Ask for Help\
**Created:** [September 6, 2024, 7:27am UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177 "2024-09-06T07:27:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SvenV](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SvenV](https://community.glideapps.com/u/SvenV)\
**Post date:** [September 6, 2024, 7:27am UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/1 "2024-09-06T07:27:34Z")

</div>

Hi all,

I’m trying to figure out how to implement a many to many relationship. I need to be able to select multiple categories for a company.

From the data point of view I think I have figured it out. I have a junction table with two id columns. One for organization id and one for category id.

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

In my organization table I do a relation to that junction table, a lookup and again a relation to display the categories in the row on the organization.  
That seems to work if I simulate it in the data sheets.

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

I’m also able to display the categories coming from the organization table.

However, I’m kind of stuck for the add and edit screens.  
On the add screen I can show all the categories but how can I achieve that rows per selected category will be saved in the junction table.

For the edit screen I would also like to have all the categories displayed and only the rows that match from the junction table selected. I would like to work with a choice (multiple options) in chip form.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 6, 2024, 11:53am UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/2 "2024-09-06T11:53:43Z")

</div>

Get rid of the junction table. Add a choice component to the add and edit screens like you want. Check the box to allow selecting multiple. Add a Split Text column to split the resulting selected choices into an array. Use that array to establish your relation.

---

<div class="post-metadata">

**Author:** ![SvenV](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SvenV](https://community.glideapps.com/u/SvenV)\
**Post date:** [September 6, 2024, 11:56am UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/3 "2024-09-06T11:56:50Z")

</div>

That’s an option too idd. Coming from a software development background it doesn’t feel that good not working with the row id though. What is someone changes the name of a category?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 6, 2024, 12:19pm UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/4 "2024-09-06T12:19:38Z")

</div>

Change your choice component to write the Row ID value of each chosen category instead of the category name.

---

<div class="post-metadata">

**Author:** ![SvenV](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SvenV](https://community.glideapps.com/u/SvenV)\
**Post date:** [September 6, 2024, 4:54pm UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/5 "2024-09-06T16:54:21Z")

</div>

Thanks for the help. Better solution indeed than junction table. Less complicated.

---

<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:** [September 13, 2024, 4:54pm UTC](https://community.glideapps.com/t/issue-with-many-to-many/76177/6 "2024-09-13T16:54:44Z")

</div>

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