cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sanrajbhar
Helper I
Helper I

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
v-micsh-msft
Community Support
Community Support

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.

View solution in original post

1 REPLY 1
v-micsh-msft
Community Support
Community Support

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.

View solution in original post

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (28,836)