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

update + patch function

Hi,

 

I Have a farm with some fields ,I need to update the records with patch function,

 

i have tried so many formulas can any one help on this .

 

 Thanks ,

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Do you want to use the Patch function to update the Edit form data?

Does the Edit form bind to selected item in your Gallery properly?

 

Firstly, please make sure the Item property of the Edit form has been bind to proper record/item in your Gallery already. Set the Item property of the Edit form (EditForm1) to following:

Gallery1.Selected

 

Then you need to modify your Patch formula as below:

Patch(
       '[MadCap_DWH].[USER_ACCESS_INFO]',
        Gallery1.Selected,
        EditForm1.Updates
)

or

Patch(
       '[MadCap_DWH].[USER_ACCESS_INFO]',
        LookUp('[MadCap_DWH].[USER_ACCESS_INFO]', PrimaryKeyColumn = Gallery1.Selected.PrimaryKeyColumn),
        EditForm1.Updates
)

Note: The EditForm1 represents the Edit form in your canvas app.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

4 REPLIES 4
Ben-Western
Helper II
Helper II

Hi @Anonymous ,

 

As you are using a form you could simply SubmitForm()

 

Alternatively if you are looking to Patch() the syntax is as follows: 

 

//For a new row
Patch(datasource, default(datasource), {item: "content"})

//Updating an existing row
Patch(datasource, gallery1.selected, {item: "content"})

 

Patch Example: https://www.youtube.com/watch?v=yS6mTRlmuls

Microsoft Docs: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Hope this helps!

 

Regards,

 

Benjamin Western | Automation Specialist

NextStep Creations

 

Taking your PowerApps Skill the NextStep

Anonymous
Not applicable

Hi,

 

Patch('[MadCap_DWH].[USER_ACCESS_INFO]',Gallery1.Selected,{emailID:DataCardValue4.Text,isActive:DataCardValue7.Text
,roleName:ComboBox2.SelectedItems.roleName,zone:ComboBox3.SelectedItems.Result,
market:ComboBox5.SelectedItems.Result,plant:ComboBox6.SelectedItems.Result})

 

As you suggested I have used this formula, but it's not working can you help on this .

Hi @Anonymous ,

 

Your Syntax looks correct.

 

However gallery1.selected (is this correct for your environment?)

 

gallery1.selected should represent the source of the single record that you are trying to patch to the datasource.

 

if your gallery is called testGallery then it would be testGallery.selected

 

Hope this helps!

 

Regards,

Hi @Anonymous ,

Do you want to use the Patch function to update the Edit form data?

Does the Edit form bind to selected item in your Gallery properly?

 

Firstly, please make sure the Item property of the Edit form has been bind to proper record/item in your Gallery already. Set the Item property of the Edit form (EditForm1) to following:

Gallery1.Selected

 

Then you need to modify your Patch formula as below:

Patch(
       '[MadCap_DWH].[USER_ACCESS_INFO]',
        Gallery1.Selected,
        EditForm1.Updates
)

or

Patch(
       '[MadCap_DWH].[USER_ACCESS_INFO]',
        LookUp('[MadCap_DWH].[USER_ACCESS_INFO]', PrimaryKeyColumn = Gallery1.Selected.PrimaryKeyColumn),
        EditForm1.Updates
)

Note: The EditForm1 represents the Edit form in your canvas app.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,065)