Preventing Repetition on many to many relationship

hello everyone,

i have the follows:

  • Contractor table which accommodate:
  1. contractor name
  2. photo.
    it is always growing table
  • Project table which accommodate:
  1. project name
  2. photo.
    it is always growing table too
  • A table to act as container for many to many relationship named Contractor’s Project to accommodate:
  1. project name
  2. contractor name

i want to prevent adding the same contractor from contractor table to the same project twice.

i am using a selection component at the Contractor’s Project table to select the contractor from Contractor table.

The main issue i am facing is how to link the Contractor table with Project table
Kindly, assist me in How could i do that?

Thank you

What if you instead added a contractor column to the project table, then added a multi-select choice component to select all of the contractors. This will give you a comma delimited list of contractors for each project in that new contractors column. Then you can use a Split Text column to split that list of contractors into an array. Now you can use that column to creat a relation from the contractor table to the project table and vice versa. That way you can eliminate the third container table all together and you won’t have to worry about duplicates.

2 Likes

Thank you so much for your idea and prompt feedback, as you usually does.

Your respected idea is really valid, but how can i add new contractor to a certain project later on?

1 Like

To add another contractor, all you need to do is open the project, select the choice component, and select another contractor from the choice list. Since it’s a multi select choice, it will have the existing contractors already marked, and you can select additional contractors. It will just update the comma delimited list in the column.

1 Like

Thank you so much, I will try that and, if you please, i will comeback if i missed something.

Thank you so much.

1 Like

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