# Layout N-N relationshop

**URL:** <https://community.glideapps.com/t/layout-n-n-relationshop/68762>\
**Category:** Ask for Help\
**Created:** [December 16, 2023, 11:15am UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762 "2023-12-16T11:15:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yvann](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yvann/32/67879_2.png) [@Yvann](https://community.glideapps.com/u/Yvann)\
**Post date:** [December 16, 2023, 11:15am UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/1 "2023-12-16T11:15:17Z")

</div>

Hello 🙂

I’m Yvan, new to Glide and my database is on GSheet.

I’m facing issues with managing N-N relationships in the layout and actions.

I have three tables: a company table SOCIETE, a shareholder table ACTIONNAIRE, and a table for N-N relationship ACTIONNAIRE2SOCIETE.

1. I’d like to add a new company and select shareholders in it, indicating each shareholder’s percentage.
2. When editing a company, I want to select shareholders in that company and update their shares.

I’m not sure how to use the Layout + Action to update multiple tables with N-N relationships.

What actions should I use to add a new company SOCIETE while updating the ACTIONNAIRE2SOCIETE shareholder list?

---

<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:** [December 16, 2023, 1:48pm UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/2 "2023-12-16T13:48:51Z")

</div>

If it were me, I would get rid of the ACTIONNAIRE2SOCIETE table.

- In the SOCIETE table, create a text column to hold a comma delimited list of shareholder IDs.
- When adding or editing a company, add a choice component with multi-select enabled to select shareholders.
- Write the selected shareholders to the new shareholder column.
- Create a Split Text column to convert that comma delimited list into an array.
- Finally build your relations between SOCIETE and ACTIONNAIRE using that Split Text array.

---

<div class="post-metadata">

**Author:** ![Yvann](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yvann/32/67879_2.png) [@Yvann](https://community.glideapps.com/u/Yvann)\
**Post date:** [December 18, 2023, 7:05am UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/3 "2023-12-18T07:05:21Z")

</div>

Thanks Jeff 🙏  
Ah ok, so you simply won’t use intermediary tables to create the relationship but will store all of it in a new column? But how do I manage the share percentage of each shareholder? In which table can I store this information?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 18, 2023, 7:21am UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/4 "2023-12-18T07:21:41Z")

</div>

> [@Yvann](#):
>
> But how do I manage the share percentage of each shareholder? In which table can I store this information?

hmm, I think that Jeff may have missed that point…

Given that you need to store both the shareholder name and their share percentage, you might be better off with a link table after all.

The alternative could be to store the shareholder/share percentage as an array of JSON strings, but that would be much more difficult to manage.

So getting back to your original question…

> [@Yvann](#):
>
> When editing a company, I want to select shareholders in that company and update their shares.

- In your SOCIETE table, create a multiple relation column that matches the SOCIETE name/ID with the same value in your link table.
- When viewing a SOCIETE details screen, add a Collection component and use that multiple relation column as the source.
- Enable editing on that collection, and that should allow you to edit the shareholder percentages.

---

<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:** [December 18, 2023, 1:56pm UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/5 "2023-12-18T13:56:19Z")

</div>

Yeah I missed the part about shareholder percentages. I’m on vacation. Maybe I need to lay low for a bit.

---

<div class="post-metadata">

**Author:** ![Yvann](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yvann/32/67879_2.png) [@Yvann](https://community.glideapps.com/u/Yvann)\
**Post date:** [December 19, 2023, 5:28am UTC](https://community.glideapps.com/t/layout-n-n-relationshop/68762/6 "2023-12-19T05:28:25Z")

</div>

Don’t worry, Jeff. Enjoy your vacation and throw away your laptop.
