cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TanguyT
Level 8

Updating DataSet content for many to many relationship subgrid

Hi,

I'm trying to create a control that will among other feature allow to display related records in a many to many relationship. This part is working great.

Now, I would like my control to be able to associate new records or disassociate existing records. I don't see at all how to achieve this.

What I am missing so far:

  • A way to find the primary record id
  • A way to associate/disassociate record. context.WebApi does not expose associate/disassociate messages and it is even not possible to get the name of the relationship

Thanks for your help

5 REPLIES 5
Power Apps Staff AnqiChen
Power Apps Staff

Re: Updating DataSet content for many to many relationship subgrid

hi Tanguy,

 

Suppose there is an entity 'Teacher', and an entity 'Student' is of N:N relationship. The way Dynamics does is internally creating a internal entity, entity name could be checked in 'Customization->Entity->Teacher->N:N relationship', let say the entityname is 'Courses'.

 

This internal entity has associated teacherid, studentid, and its own 'Courses' entity record id.

Regarding your question on how to associate/disassociate, ideally, it should be use webAPI to create/delete record in this 'Courses' table.

 

The problem is that it seems webAPI is not able to CRUD on this internal entity, if that's the case, what we suggested is that you create an explicit entity 'Courses' table, with keys like 'CourseId', 'TeacherId','StudentId'. Then Teacher:Courses is 1:N, Student:Course is 1:N, and Teacher:Student is N:N.

 

Then if you need to associate/disassociat Teacher:Student relationship, it's just CRUD on this 'Course' entity.

 

Now it comes to another question, at a page Teacher, with related Courses subgrid, how do we associate a student. It should be, your subgrid dataset control, its manifest has two <data-set>s

<data-set> //bind to entity courses

<data-set> // bind to entity students

The 2nd <data-set> is used to retrieve all candidate students and let user to pick one. As you already have page TeacherId, you have StudentId when user picked, you should be able to use webAPI to create a new Course record.

 

Hopefully it makes sense to you

 

Anqi

TanguyT
Level 8

Re: Updating DataSet content for many to many relationship subgrid

Hi Anqi,
Unfortunately, it does not answer my question.
It’s not about how I should change/adapt customizations to fit what PCF can handle. What users/customers will expect is that they can transform their NN subgrid (that allows associate/disassociate) with another layout but with same capability.

My scenario is a simple tagging scenario. I have 10 tags, I want to display all of them as checkboxes. Ticking a checkbox will associate record. Unticking will disassociate record.

With the least effort I can imagine, PCF should:
- provide the relationship name for a dataset
- expose at least the Execute method of the web api so that we can build our own call to associate/disassociate records, like described by Scott Durow: https://github.com/scottdurow/PowerApps-Samples/blob/model-driven-app-webapi/cds/webapi/ts-model-dri...

Is this something I can expect to be implemented? If not, I would really encourage you to document this as a limitation of PCF.
Power Apps Staff AnqiChen
Power Apps Staff

Re: Updating DataSet content for many to many relationship subgrid

hi Tanguy,

 

I am sorry that I misunderstand your question. Regarding the ask:

- provide the relationship name for a dataset

   Yes, we do not provide relationship name for a dataset to the control. A work-around is that a control could have a static input string property and when configured that control, customizer could fill in the relationship name

 

- expose at least the Execute method of the web api so that we can build our own call to associate/disassociate records,

Hopefully this helps

 

Anqi

 

 

TanguyT
Level 8

Re: Updating DataSet content for many to many relationship subgrid

Thank you for these explanation

 

Any chance you add the relationship name in the context? And add the method Execute in the typing file?

Highlighted
TanguyT
Level 8

Re: Updating DataSet content for many to many relationship subgrid

bumping to see if there is any progress on these two requests:

- adding relationship name in context

- exposing execute method for the webapi

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,725)