cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to update database record from text input values

Hi -  I have a screen with one drop down button and multiple text fields (say 6). When a drop down value is chosen, text fields will be auto populated and the user can update any of these text fields. this is all working fine. But I do not know how to update this particular record in data source table. I am not using form, the drop down and text input values are just on the screen.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

The below worked for me when I used either dropdown or combo box -

Patch( ConsumerList,

LookUp(ConsumerList,'Content.InvoiceId'=ComboBox1.Selected.'Content.InvoiceId'),

{'Content.Customer':TextInput1_1.Text,'Content.Owner':TextInput2_1.Text,'Content.Vendor':TextInput3_1.Text,

'Content.PurchaseOrderId':TextInput4_1.Text,'Content.InvoiceDate':TextInput5_1.Text});

View solution in original post

4 REPLIES 4
SkiDK
Solution Sage
Solution Sage

Hi @Anonymous 

 

You can use the Patch function for this: Patch function in Power Apps (contains video) - Power Apps | Microsoft Docs

 

Patch(
  dbList,
  LookUp(dbList, ID = 1),  //finding the record to update
  {
    Field1 = textinput1.Text,
    Field2 = dropdown.Selected.Value,
    ...
  }
);

Adding a new record in the db:

Patch(
  dbList,
  Defaults(dbList),
  {
    Field1 = textinput1.Text,
    Field2 = dropdown.Selected.Value,
    ...
  }
);

 

Hope this helps!

 

Anonymous
Not applicable

Hi @SkiDK  -  Inserting new record worked with Patch. But I need to update existing record.

But I am getting error when trying to update existing record. here is what I am doing -

 

Patch(table1,LookUp(table1,'Content.InvoiceId'= Dropdown2.Selected.'Content.InvoiceId')
{
'Content.Customer':TextInput1.Text,
'Content.Owner':TextInput2.Text,
'Content.Vendor':TextInput3.Text,
'Content.PurchaseOrderId':TextInput4.Text,
'Content.InvoiceDate':TextInput5.Text

}
) ;

 

 

Error I am getting -

error.JPG

@Anonymous ,

You have two threads going on the same issue - I responded to the other one here

Anonymous
Not applicable

The below worked for me when I used either dropdown or combo box -

Patch( ConsumerList,

LookUp(ConsumerList,'Content.InvoiceId'=ComboBox1.Selected.'Content.InvoiceId'),

{'Content.Customer':TextInput1_1.Text,'Content.Owner':TextInput2_1.Text,'Content.Vendor':TextInput3_1.Text,

'Content.PurchaseOrderId':TextInput4_1.Text,'Content.InvoiceDate':TextInput5_1.Text});

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,361)