Announcements
I Have a table that i need to get a value based in RowName (described in the first Column) and Column NameSo i Use Lookup to the get entire Line that i need, them I need the value-based in the Column name, could i use the code: DataTable.Selected.ColumnName But i need the ColumnName to be Dynamic .. based in a ListBox selection, for example:Maybe a syntax would be something like this:Set(varColumn; ListBox.SelectedItem.ColumnName)DataTable.Selected.[varColumn] How can i change the ColumnName in the comand DataTable.Selected.ColumnName
Try
Listbox1.SelectedItems.Value
Or
Listbox1.SelectedItems.ColumnName
------------If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Thx for you answer but this is not what that i need i need that the ColumnName to be Dynamic Based in the User Choice but i don´t know the syntax for that .. or if it´s not possible for now Maybe a syntax would be something like this:Set(varColumn; ListBox.SelectedItem.ColumnName)DataTable.Selected.[varColumn]
Well, I might have misunderstood you. You may have to explain further if possible screenshot
Hi@marcioslash,
Do you want to make DataTable selected column dynamically based on the Listbox selected value?
In general, we cannot make the column dynamic within a single DataTable. We use the following formula to get a fixed value within a column. I am afraid there is no way to make 'ColumnName' dynamically currently in PowerApps.
DataTable1.Selected.ColumnName
If you would like this feature to be added to PowerApps, please submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
As an alternative solution, you can add multiple DataTables to change columns dynamically.
Best Regards,
Qi
Yeah, this is the point 😕I tried the solution:Lookup(myCollection; ListBox.Selected.Description; ListBox1.Selected.Description)Where ListBox = RowName and ListBox1 = CollumnName but return no results and there is no error ... i don´t know whySome suggestions to resolve this issue in another way?Get an item from a table based in Dynamic Column way ??
@marcioslash ,
As @v-qiaqi-msft has said, there is no way to dynamically describe columns (or any other controls or lists) in Power Apps.
The best you can do is if there are a relatively small number do If statements
Lookup( myCollection; If( Condition=xxxx; xxxx=ListBox.Selected.Description; Condition=yyyy; yyyy=ListBox.Selected.Description; Condition=zzzz; zzzz=ListBox.Selected.Description ) )
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 382 Super User 2026 Season 2
Mohsin Ali 329
WarrenBelz 187 Most Valuable Professional