cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Create a N:N relationship Lookup field

Dear colleagues,

 

I am working on a model driven PowerApps application.

 

When I create a N:N (many to many) relationship the correspondent lookup field is not being auto-created.

I need to add this lookup field, with multiple selection possibility, in one of the entities.

 

Could you please help me?

Thanks,

rvdias

 

1 REPLY 1
Highlighted
Microsoft
Microsoft

Re: Create a N:N relationship Lookup field

Hi @rvdias :

Can you tell me:

Do you want to add a lookup field that related to another entity?(N:N relationship)

What you want to do with the lookup field?

I'm afraid that there will be no lookup field generated automatically when you create a many-to-many relationship.

(If you create a lookup field manually between N:N entities, the system will automatically generate a 1:N relationship between these two entities. So I suggest you don’t do this.)

Firstly, let me explain why you can’t do this :

Unlike One-to-Many or Many-to-One relationships, there is no lookup field on either side of the relationship.  Instead, CDS maintains a separate hidden entity on behalf of the relationship, sometimes referred to as an associative entity or join table. There is no direct access to this entity.

We can simplify things considerably if we pick a side.

For example, there is a Many-to-Many relationships between teachers and students .From a single Student’s perspective this looks like a One-to-Many relationship and we can access the information exactly as we do any other One-to-Many relationship:

 

1.PNG

I think this link will help you a lot:

Option Sets and Many-to-Many Relationships for Canvas apps:https://powerapps.microsoft.com/en-us/blog/option-sets-and-many-to-many-relationships-for-canvas-app...

Finally, If you just want to use the lookup field to filter the records that in the associated entity . Here is my solution for your reference:

1\add a drop down control(Dropdown1) and set it’s items property to:

 

 

Students       /* Students is my custom entity*/

 

 

2\add a gallery control and set it’s items property to:

 

 

Dropdown1.Selected.teachers      /* teachers is my custom entity, there is a Many-to-Many relationships between teachers and students */

 

 

2.PNG

Best Regards,

Bof

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,133)