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 / Drop down menu to swit...
Power Apps
Unanswered

Drop down menu to switch between datasources

(0) ShareShare
ReportReport
Posted on by

Hi!

 

I've got an app that displays content from different excel tables, and lets you edit them. There are however quite a few data sources (10+), I've got a drop down menu to select from, but have to hard code every new table added. So I would like to make the process of adding new data sources easier, by not having to change code. Currently the drop down looks like this:

 

OnChange:

Switch(Dropdown.Selected.Value; "Option 1"; Set(DataSource;[@Table1]); "Option2"; Set(DataSource;[@Table2]) etc... &
Navigate(ListGallery;ScreenTransition.None)

Items

["Option1"; "Option2"] etc..

 

All of the excel tables are stored in a folder, "lists". After experimenting for a bit, I made a flow that automatically adds the name of new files created here to a separate excel table, called datatables. The idea was to use this table to fill out the drop down menu, and use that value to point to a table, like so:

 

OnChange

Set(DataSource;Dropdown.Selected.Datatables) & Navigate(ListGallery;ScreenTransition.None)

 

Items

datatables

 

The datasource variable is used to display and sort the information in the table once it's navigated to the gallery. 

 

The dropdown contained the names of all the new datasources. But the actual problem is that pointing to a datasource this way does not seem to work, is there a way to achieve this?

 

 

 

 

 

 

 

 

 

Categories:
  • mmollet Profile Picture
    3,187 on at

    Only way I can think of is to use a switch statement based on the selection of the dropdown. Fill the dropdown with choices however you see fit, hardcoded or doing what you described in your post. Now do something like:

    Switch( Dropdown1.Selected.Value,

    "First Database",

    Filter(FirstDBName, something = "test"),

    "Second Database",

    Filter(SecondDBName, something = "test"),

    ...

     

    Make one case for each data source. As the user chooses from the dropdown it will use the proper datasource based on thier choice. The issue with this is that the gallery you display it in will be a pain to manage unless all the columns are the same. You could also use a switch case on the controls in your gallery just might take a bit to do and im not sure how it works or if it works. The idea is as follows for the gallery controls:

    Switch(Dropdown.Selected.Value,

    "First Database",

    ThisItem.FirstName,

    "Second Database",

    ThisItem.ItemName,

    ...

     

    Hope this helps in some way.

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 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard