Showing results for 
Search instead for 
Did you mean: 

Patch - Referance a column name via a variable

Is that possible to make PowerApps can refer to a column via a variable?


I want to use "Patch" function to update column in Data Source. But the number of columns to be updated and columns name is not fixed. So it would be great of PowerApps to allow dynamically refer to a column.



For example, is it possible to replace the "DataField_8" below with dynamic variable such as "Dropdown2.Selected.Value"?


Patch(dbo_Update, LookUp(dbo_Update, ProductCode=Dropdown1.Selected.Value), {
    DataField_8 : TextInput1.Text
Status: Under Review

We hear you and appreciate your patience.  Unfortunately this is not easy for us to do.  Unlike VBA and other languages, Power Apps is strongly typed and named - everything is well established at compile time.  It's one of the fundamental principles of the product.  This allows us to detect more errors, optimize, and provide better intellisense during authoring.


Can you tell us more about the scenarios in which this would be helpful?  Some examples with code would be great.  Perhaps we can find a solution that addresses the need without making field names fully dynamic.

Frequent Visitor

This would be an extremely useful feature.  I've spent a full day trying to find a more efficient way to accomplish something and it turns out my 'hack' (massive Switch formula) is the best approach.  Especially frustrating as the referenced column structure in my app is somewhat fluid* so I have to update the formula every-time we add a column or consolidate columns.


*We are trying to normalize the various customer questionnaires our teams use (multiple redundancies and differences in term definitions) into a single SharePoint list.  The App allows users to select the form they want to use and it only displays the questions relevant to them (with answers pre-populated if someone already asked the question in a different forum).  Over time we plan to consolidate questions (columns) and add new questions (columns) as new requirements arise

Not applicable

Using dynamic column names will not violate you beautiful world defined by “Power Apps is strongly typed and named - everything is well established at compile time.” The reason is simple, column names are strings, so any variable of type string can be used as a column name. Simple to incorporate in PowerApps world. No?

Helper II



In addition to dynamic patch functions, Having dynamic columns allows something so simple as a dynamic filtering interface for our data in our apps. 

A large majority of the "power apps" that are created for my organization are for small projects, including a BUNCH of "trackers" (tracking current status of various different processes within our company) These trackers often come with galleries full of table-layout data. I understand how to create switch statements that allow for this. They work fine, as long as our processes NEVER change (sometimes that may hold true. But in today's world, this is becoming less and less true) 

Realistically, processes change, and therefore, so do some of the options/statuses in our trackers. Not drastically, lets just add a new "Status" and call it "Returned For More Info" I would like to just add it to my list of dropdown options in my sharepoint list. and add "Return for more info" to the existing list of: "New","Accepted","Rejected"

Now, (because i populated a gallery Items with Choices(souce.status) ) My gallery instantly reflects this change! and now i have a new status i could potentially click on in my gallery to filter by (because before, if i click "New" it filtered for new, because that's in my switch statement, So I click on my dynamically generated "Return for more info" button, but my table breaks and i see absolutely no data. That's because the option "Returned for More Info" doesn't exist in my hard-coded switch statement. That's a poor breaking point. I have set up an almost entirely dynamic app that can handle dramatic changes without ever being needed to touch by a developer again. But Now my Sharepoint guys not only have to make changes to the sharepoint list to effect the app, but then i STILL have to open powerapps in dev mode and make changes to that switch statement, when i shouldn't have to. I should be able to update my sharepoint dropdown column options, and let it fully reflect and trickle through my app. 

Regular Visitor

MUST have to build multi-lingual apps and enable the user to add different languages on the fly...

Post Patron

Since a table can be a property of a component: different tables might be used with different field names.

If I use a switch statement powerapps branching the different possible field names, powerapps will just say it does not know the names. If I could reference de fields by string, powerapps would not get mad about unknown names in the editor and might even do what is supposed to do 😉

Frequent Visitor

Absolutely need this. I'm new to PowerApps and ran into this issue on day 2 and now my boss is suggesting Glide Apps, which I don't want. 


My use case:

Sharepoint list 1 with columns:








... for 30 more tasks (so 60 more columns)


Sharepoint list 2 with one column made up of task names:





I want to create a gallery of the task names (using List 2) then use patch to update my table with one of two buttons:




Started button:

Patch(MF_unit_tracker_job_C123,LookUp(MF_unit_tracker_job_C123,Title=var_unit_key),{Indirect(ThisItem.Title & "_start"):Now()})​


Finished button:

Patch(MF_unit_tracker_job_C123,LookUp(MF_unit_tracker_job_C123,Title=var_unit_key),{Indirect(ThisItem.Title & "_finish"):Now()})​


I would also use an indirect type of function for the label text and have another column in the Task list for a friendly name. 


Approaching 3 years on this request. Inserting an if switch for 66+ columns is not a viable solution. 

Frequent Visitor

I have a SharePoint List with 120 columns used to record periodic maintenance activities at various worksites.

The list is populated through a Form in an App.


Not all columns in the list apply to every site, so I have built a second list that references each question and shows true or false against each site. I want to use this second list to determine whether or not questions are visible for the selected worksite.


The easiest way to do this that I can come up with is to use an expression in the Visible field of each question such as LookUp(Reference_List, Site=myLocation, Parent.DataField)

In this case Parent.DataField would be the column title in both SharePoint Lists. 


This doesn't currently work unless I explicitly replace Parent.DataField with the column name, but if it did it would save a lot of time as I could just paste the same expression into each card rather than having to specify the column name each time.

Regular Visitor

Mi escenario: tengo muchas listas personalizando el formulario, por lo que quiero controlar ciertas funciones en una lista nueva:

Lista de condiciones

Lista1Campo1 > Campo2 y campo 1 <= 5000
Lista1Campo3 = True2
Lista2Campo5 = Campo 61


La idea es en el formulario de la Lista1 leer el texto de la lista de condiciones, filtrar por campo Lista, con un split, obtener Campo1.value y compararlo con Campo2.value, para obtener verdadero o falso y luego utilizar el resultado 1 para filtrar validar propiedades.

Si solo fuera una lista, seria fácil hacerlo directamente, pero como debo controlar hasta 80 listas diferentes, lleva mucho tiempo entrar a cada una y mantener (crear, editar o eliminar) cada formula.

New Member

Any Update? 

Frequent Visitor



I, too, would find this extremely useful. I'm trying to build my apps on generic components to speed up development time. One such component is meant to be a gallery inside a variable height gallery - both using the same data source, but the variable height gallery is used to group the items through the Distinct function. The results of the sub-gallery are filtered by whatever that function returns. I want to be able to feed any column name into the Distinct function, so that I can have a component that's truly dynamic and doesn't depend on static data sources and also - and more importantly - I want the end user to be able to select what column he wants to group the data in the galleries by without relying on static code.


SortByColumns is one function that seems to require column names to be fed as strings. Could this not be made possible for all functions used for data transformation, like Distinct? Maybe through an additional function that would only work inside of them, used for transforming strings into column names?