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 / Use Gallary to select ...
Power Apps
Answered

Use Gallary to select Sharepoint List for Another gallary

(0) ShareShare
ReportReport
Posted on by 63

Hello,

 

I am making my admin tables to allow for in app edits for dropdowns that exist throughout my app. As most of the sharepoint lists consist of a single collum called Title, I am attempting to reuse the same gallery control to reduce the number of Items I have to recreate. My admin screen consists of 2 galleries, a menu which has a defined list of items listed below, and the gallery where the edits are made. The lists I wish to edit are defined as part of the table function under "AdminListName" The aim is to have the second gallery pull the SharePoint list name from the 1st gallery named Admin_Menus run the Items command below. I am getting errors as the app is reading the table name as a text vaule.

 

Admin_menu (Select the table to edit)

 

 

SortByColumns(Filter(
 Table(
 {
 AdminMenuText: "Users",
 AdminMenuLevel: 5,
 AdminMenuOrder: 0,
 AdminSingleColumn: false,
 AdminListName: "Admins_for_Tracker"
 },{
 AdminMenuText: "Fiscal Year",
 AdminMenuLevel: 1,
 AdminMenuOrder: 1,
 AdminSingleColumn: true,
 AdminListName: "FYs"
 }{
MORE TABLES TO EDIT EXIST HERE
}
 ),AdminMenuLevel <= var_admin),"AdminMenuOrder",SortOrder.Ascending)

 

 

GAL_Admin_Single_Column (Gallery to be used when a single Item column exists)

 

 

SortByColumns(Filter(Admin_Menus.Selected.AdminListName,StartsWith(Title,Admin_Search_Box.Value)),"Title",SortOrder.Ascending)

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    MudassarSZ365 Profile Picture
    591 on at

    Hi @gizmobrat ,

    Switch(
     Admin_Menus.Selected.AdminListName,
     "Admins_for_Tracker", SortByColumns(Filter(Admins_for_Tracker, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending),
     "FYs", SortByColumns(Filter(FYs, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending),
     // ...additional cases for each list...
     SortByColumns(Filter(AllItems, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending) // Default case if none match
    )
  • gizmobrat Profile Picture
    63 on at

    @MudassarSZ365,

    Thanks for the quick reply.

    1. Where would I place this formula?

    2. What would be the best way to reference the selected table for my patch, reset, and edit controls?

    -gizmobrat

  • MudassarSZ365 Profile Picture
    591 on at

    @gizmobrat ,

    However, you can use a workaround by having a condition based on the selection that changes the data source of your gallery. You'll need to write out each potential data source in your code. Below is an example using the Switch function, which could be used in the Items property of your GAL_Admin_Single_Column gallery:

    Switch(
     Admin_Menus.Selected.AdminListName,
     "Admins_for_Tracker", SortByColumns(Filter(Admins_for_Tracker, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending),
     "FYs", SortByColumns(Filter(FYs, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending),
     // ...additional cases for each list...
     SortByColumns(Filter(AllItems, StartsWith(Title, Admin_Search_Box.Value)), "Title", SortOrder.Ascending) // Default case if none match
    )

    In the above code:

    Replace Admins_for_Tracker and FYs with the actual names of your SharePoint lists (these should be the internal names used in Power Apps to refer to those lists).
    Admin_Menus.Selected.AdminListName is the text value from the selected item in your Admin_menu gallery, which you're using to determine which SharePoint list to display in GAL_Admin_Single_Column.
    AllItems in the default case should be replaced with a generic or error-handling scenario, or you can choose to return an empty table like Table().

  • gizmobrat Profile Picture
    63 on at

    Last Question,

    If I have some buttons that exist outside the gallery, would I need to hard code this switch option also? 

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard