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

Dynamic Column Names When Patching a Collection

Hi,

 

I have a gallery that is connected to a collection to populate the fields. From this gallery i have buttons where i want another collection to be updated. However it seems that i cant dynamically reference a column name from within the patch function, so ust be hard coded. This will not work as each items changes based on the gallery.

 

tldr: i need to update a specific column in a collection based upon another collection.

 

Does anyone have any workarounds for this? Currently trying the below formula, but as field names arent dynamic it is producing static results

 

Patch( CollectionName,
First( Filter(CollectionName, Identifier = Text(VarIdentifier) ) ), {StaticColumn: "Unacceptable"} )

 

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

You're right - Power Apps does not support dynamic column names at this time.

 

The workaround is to use an If() or Switch() statement to address all possible cases and decide which Patch() or other data operation the app needs to perform.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
BCLS776
Super User
Super User

You're right - Power Apps does not support dynamic column names at this time.

 

The workaround is to use an If() or Switch() statement to address all possible cases and decide which Patch() or other data operation the app needs to perform.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Anonymous
Not applicable

Thanks for getting back to me. As a workaround i am storing the data collected as rows and sorting it out in PowerBI afterwards. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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