web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get data from a Table ...
Power Apps
Answered

Get data from a Table Power apps

(0) ShareShare
ReportReport
Posted on by 19

I Have a table that i need to get a value based in RowName (described in the first Column) and Column Name

So 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




Categories:
  • eka24 Profile Picture
    20,925 on at

    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.

  • marcioslash Profile Picture
    19 on at

    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] 


  • eka24 Profile Picture
    20,925 on at

    Well, I might have misunderstood you. You may have to explain further if possible screenshot

    ------------

    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.

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    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

  • marcioslash Profile Picture
    19 on at

    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 why

    Some suggestions to resolve this issue in another way?

    Get an item from a table based in Dynamic Column way ??

  • Verified answer
    WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    @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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard