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

Patch function - define column to update by context variable

Hello!

 

When using Patch function, is it possible to define the column to be updated by some other way than just writing it into the function? For example by context variable or selected value in a gallery.

 

 

Patch( MySPlist, Defaults(MySPlist), {Gallery1.Selected.Location:Dropdown1_1.Selected.Value})

 

br,

markku

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Patch function - define column to update by context variable

Hi @marovil,

 

Do you want to define the column to be updated within the Patch function using Dynamic content?

 

I have made a test on my side, I afraid that there is no way to achieve your needs in PowerApps currently.

 

When using Patch function to add records/update the existing records within your data source, the ChangeRecord argument part must match the BaseRecord argument part within this function. In other words, the columns that you typed within the ChangeRecord argument part must match the BasedRecord argument part.

 

If you defined a column using a dynamic content (Context Variable or selected value in gallery control) within the Patch function, the Patch function could not resolve the dynamic content automatically (the Patch function could not recognize the dynamic content as a column name).

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

 

Best regards,

Kris

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

3 REPLIES 3
mr-dang
Level 10

Re: Patch function - define column to update by context variable

Hi @marovil,

This is a good question -- I can see how having dynamic column names appear would be helpful. I once suggested having an INDIRECT() function. In my case, I provided each of my users with their own column of data, so I wanted to place data in the right spot when writing. This would have been great for writing data the way I wanted to view data in a grid.

 

 

What I've learned since then is that creating a ton of columns is not very efficient. If you're retrieving data and all the columns but a few are blank, the dimensions of the table are needlessly giant. Understanding this helped me change to build multiple tables with relationships that connected them. 

 

I don't think our use cases are similar, but I thought I'd share that if they were.

 

Let me know if this was helpful.

 

Mr. Dang

________

Microsoft Employee
@8bitclassroom
Community Support Team
Community Support Team

Re: Patch function - define column to update by context variable

Hi @marovil,

 

Do you want to define the column to be updated within the Patch function using Dynamic content?

 

I have made a test on my side, I afraid that there is no way to achieve your needs in PowerApps currently.

 

When using Patch function to add records/update the existing records within your data source, the ChangeRecord argument part must match the BaseRecord argument part within this function. In other words, the columns that you typed within the ChangeRecord argument part must match the BasedRecord argument part.

 

If you defined a column using a dynamic content (Context Variable or selected value in gallery control) within the Patch function, the Patch function could not resolve the dynamic content automatically (the Patch function could not recognize the dynamic content as a column name).

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

 

Best regards,

Kris

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

marovil
Level: Powered On

Re: Patch function - define column to update by context variable

Hi,

 

thank you for your reply, this is clear now, I'll use different kind of approach to my problem.

 

br,

markku

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,490)