cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sanrajbhar
Level: Powered On

Patch the Existing filtered records on EditForm - dealing with many-to-many

I am creating form to have functionalities - search , edit , new records. I am using many to many table in Azure SQL.

My Data looks:

 

A_tbl

[A_id:1,A_id:2,A_id:3]

  - My main table

 

 

Bridge_tbl

{A_id:1,B_ID:1},{A_id:1,B_ID:2},{A_id:1,B_ID:4}

 

 

B_tbl

{B_id:1, nameid:”1”}, {B_id:2, nameid:”2”}, {B_id:3, nameid:”3”}, {B_id:3, nameid:”4”}

 

 

Another tble for nameid/name

 

Name_tbl

{ nameid:”1”, name:”Alex”}, { nameid:”2”, name:”Ian”}, { nameid:”3”, name:”Kali”}, { nameid:”4”, name:”Kate”}

 

 

My gallery item is having view from A_tbl, Bridge_tbl, Name_tbl  and retrieve the [name] rather using two lookup  which is works but too slow so utilizing view. Lets call it View_Gall_tbl.

 

When I clicked on item on gallery  - I can then show from A_tbl (using lookup in item = LookUp(View_Gall_tbl, ID = gall_app.Selected.appID)

 

So I can ViewForm with A_tble information with  [name].

What I need now -  On Edit form Mode – Patch this

 

From

 

A_id = 1    ->  B_id = 1,2,4   -Multiples records in AzureSQL

 

 

To - adding one more related item

 

A_id = 1 ,    ->  B_id = 1,2,4,3  

 Patched Kali as name in bride tble - A_ID = 1 , 

 

 

 

I am using combo box for [name] and retrieving related stuff – the related name has been comma joined in my view.

 

Sorry for confusing long question. maybe rephrase seeing responses.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Patch the Existing filtered records on EditForm - dealing with many-to-many

So the current situation here is:

A_tbl is configured as the data source of the View form control, and based on the selection, you would like to update the bridge_tbl with one additional record, right?

 

If this is the case, then there is no need to take use of an EditFrom control, we could just take use of some controls to make it work.

The control that we need should be:

1. Navigate button,

2. Combo Box control for the B_tbl to hold the values for the NameId.

3. Display the confirmation of the data need to be submitted.

4. A Button to update the changes, using patch ().

 

Things to take a note:

A table which works in PowerApps should have Primary key defined, assuming here Bridge_tbl has a auto-generated primary key field, then the Patch function should be written as below:

patch(Bridge_tbl, defaults(Bridge_tbl), {A_id:Gallery.Selected.appID, nameid:First(ComboBox.SelectedItems).nameid})

If I understand the table structure correctly.

 

Regards,

Michael

 

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 REPLY 1
Community Support Team
Community Support Team

Re: Patch the Existing filtered records on EditForm - dealing with many-to-many

So the current situation here is:

A_tbl is configured as the data source of the View form control, and based on the selection, you would like to update the bridge_tbl with one additional record, right?

 

If this is the case, then there is no need to take use of an EditFrom control, we could just take use of some controls to make it work.

The control that we need should be:

1. Navigate button,

2. Combo Box control for the B_tbl to hold the values for the NameId.

3. Display the confirmation of the data need to be submitted.

4. A Button to update the changes, using patch ().

 

Things to take a note:

A table which works in PowerApps should have Primary key defined, assuming here Bridge_tbl has a auto-generated primary key field, then the Patch function should be written as below:

patch(Bridge_tbl, defaults(Bridge_tbl), {A_id:Gallery.Selected.appID, nameid:First(ComboBox.SelectedItems).nameid})

If I understand the table structure correctly.

 

Regards,

Michael

 

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 318 members 5,120 guests
Please welcome our newest community members: