Skip to main content
Community site session details

Community site session details

Session Id : IUKtRGqrM+hLgNUI80+tnv
Power Apps - Building Power Apps
Unanswered

Can you create a dropdown with the names of a column in a table?

Like (0) ShareShare
ReportReport
Posted on 21 Nov 2023 01:14:54 by 825 Moderator

I am trying to super simplify the ability to search a table. One though is that I could create dropdown that would list the column names of a table and provide a text field to enter text for a search on the column chosen. Is this possible? Either that or provide a second dropdown that had the results of the column chosen from the first dropdown.

Categories:
  • futr_vision Profile Picture
    825 Moderator on 21 Nov 2023 at 15:38:39
    Re: Can you create a dropdown with the names of a column in a table?

    I can see going this route if I want to programmatically grab the column names. I don't want all of the columns however. I think @swaminawale might have hit on a more simplistic and precise way of handling this although it does involve the manual input of the column names. I need to think about this a little more. Ideally I want to get to a solution that is going to save me real estate in my app since the results section is going to have a lot of data and I prefer not having to make the user scroll or navigate around alot.

  • futr_vision Profile Picture
    825 Moderator on 21 Nov 2023 at 15:35:05
    Re: Can you create a dropdown with the names of a column in a table?

    Creating a dropdown to select a column to search could be overkill if I can just use a search box as @AARON_C suggested. However, I can see using a dropdown if I need to do something other than or in addition to a text search. For example, if one of my columns was a start date of the type date then selecting that in the dropdown might swap out the text field for search with a date picker.

  • futr_vision Profile Picture
    825 Moderator on 21 Nov 2023 at 15:32:11
    Re: Can you create a dropdown with the names of a column in a table?

    This sounds like a super simple solution if I can use a single text box and search columns that are searchable and that I designate should be searched. I'll need to test this out as I get further down the road with this build.

  • v-qiaqi@microsoft.com Profile Picture
    on 21 Nov 2023 at 05:36:43
    Re: Can you create a dropdown with the names of a column in a table?

    Hi @futr_vision,

    Do you want to select column names from dropdown?

     

    Actually, we could using the following formula to achieve this:

    ClearCollect(
     colTable1,
     TableName
    );
    
    // get the column headers
    Set(
     varColumnNames,
     Distinct(
     Ungroup(
     MatchAll(
     JSON(
     colTable1,
     JSONFormat.IgnoreBinaryData
     ),
     "([^""]+?)""\s*:"
     ).SubMatches,
     "SubMatches"
     ), Value)
    )

    Then populate the dropdown with the variable:

    varColumnNames
  • swaminawale Profile Picture
    195 on 21 Nov 2023 at 05:32:48
    Re: Can you create a dropdown with the names of a column in a table?

    Hi @futr_vision ,

     

    You can do it and it is possible. In my recent project I did the same.

     

    I've created a dropdown and in that I manually entered the column names ( because I didn't need all columns) and had a text input next to it. then applied a filter formula.

     

    Same way you can achieve it. 

  • AARON_C Profile Picture
    2,233 Most Valuable Professional on 21 Nov 2023 at 05:20:58
    Re: Can you create a dropdown with the names of a column in a table?

    Hi @futr_vision,

     

    You can just use the Search function on the Items property of your gallery. Search only works with columns that are of type Text. This would looks something like:

     

     

    Search('Data source', TextInput1.Text, "Column 1", "Column 2", "Column 3")
    
    // Change TextInput1 to your Text Iput name
    // Change Columns 1, 2, 3 to Columns in your Data source you would like to search

     

     

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473