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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery with multiple ...
Power Apps
Unanswered

Gallery with multiple Sort fields will not show any data

(0) ShareShare
ReportReport
Posted on by 1,827 Season of Giving Solutions 2025

I have a gallery that is connected to sharepoint list, the gallery have the following formula for the items:-

 

Switch(DashBoarSortBy.Selected.Value,



"Network",
SortByColumns(Filter('Work Orders',
('Work Order Status'.Value = "Assigned" Or 'Work Order Status'.Value="New") And
((Created >= colSelectedDateCreated And Created <= colSelectedDateCreated2 ) Or IsBlank(colSelectedDateCreated)) And
(('Start Date.' >= colSelectedDateStartDate And 'Start Date.' <= colSelectedDateStartDate2 ) Or IsBlank(colSelectedDateStartDate)) And
(('End Date.' >= colSelectedDateEndDate And 'End Date.' < colSelectedDateEndDate2 ) Or IsBlank(colSelectedDateEndDate)) And
(Street = colSelectedStreetName Or IsBlank(colSelectedStreetName)) And
(Direction = colSelectedDirectionName Or IsBlank(colSelectedDirectionName)) And
('Location Name' = colSelectedLocationName Or IsBlank(colSelectedLocationName)) And
('Work Order Type'.Value = colSelectedTypeName Or IsBlank(colSelectedTypeName)) And
('Technician Name'.Email = colSelectedTechnicianName Or IsBlank(colSelectedTechnicianName) Or 'Work Order Type'.Value ="Posting"
Or 'Work Order Type'.Value ="UnPosting" Or 'Work Order Type'.Value ="Campaigns Photos" ) And
(Brand = colSelectedBrandName Or IsBlank(colSelectedBrandName)) And
('Work Order Status'.Value = colSelectedTStatusName Or IsBlank(colSelectedTStatusName))
),"NetworkName",SortOrder.Ascending,"SequenceNumber",SortOrder.Ascending),
"Created",
SortByColumns(Filter('Work Orders',
('Work Order Status'.Value = "Assigned" Or 'Work Order Status'.Value="New") And
((Created >= colSelectedDateCreated And Created <= colSelectedDateCreated2 ) Or IsBlank(colSelectedDateCreated)) And
(('Start Date.' >= colSelectedDateStartDate And 'Start Date.' <= colSelectedDateStartDate2 ) Or IsBlank(colSelectedDateStartDate)) And
(('End Date.' >= colSelectedDateEndDate And 'End Date.' < colSelectedDateEndDate2 ) Or IsBlank(colSelectedDateEndDate)) And
(Street = colSelectedStreetName Or IsBlank(colSelectedStreetName)) And
(Direction = colSelectedDirectionName Or IsBlank(colSelectedDirectionName)) And
('Location Name' = colSelectedLocationName Or IsBlank(colSelectedLocationName)) And
('Work Order Type'.Value = colSelectedTypeName Or IsBlank(colSelectedTypeName)) And
('Technician Name'.Email = colSelectedTechnicianName Or IsBlank(colSelectedTechnicianName) Or 'Work Order Type'.Value ="Posting"
Or 'Work Order Type'.Value ="UnPosting" Or 'Work Order Type'.Value ="Campaigns Photos" ) And
(Brand = colSelectedBrandName Or IsBlank(colSelectedBrandName)) And
('Work Order Status'.Value = colSelectedTStatusName Or IsBlank(colSelectedTStatusName))
),"Created",SortOrder.Descending),
"SequenceNumber",
SortByColumns(Filter('Work Orders',
('Work Order Status'.Value = "Assigned" Or 'Work Order Status'.Value="New") And
((Created >= colSelectedDateCreated And Created <= colSelectedDateCreated2 ) Or IsBlank(colSelectedDateCreated)) And
(('Start Date.' >= colSelectedDateStartDate And 'Start Date.' <= colSelectedDateStartDate2 ) Or IsBlank(colSelectedDateStartDate)) And
(('End Date.' >= colSelectedDateEndDate And 'End Date.' < colSelectedDateEndDate2 ) Or IsBlank(colSelectedDateEndDate)) And
(Street = colSelectedStreetName Or IsBlank(colSelectedStreetName)) And
(Direction = colSelectedDirectionName Or IsBlank(colSelectedDirectionName)) And
('Location Name' = colSelectedLocationName Or IsBlank(colSelectedLocationName)) And
('Work Order Type'.Value = colSelectedTypeName Or IsBlank(colSelectedTypeName)) And
('Technician Name'.Email = colSelectedTechnicianName Or IsBlank(colSelectedTechnicianName) Or 'Work Order Type'.Value ="Posting"
Or 'Work Order Type'.Value ="UnPosting" Or 'Work Order Type'.Value ="Campaigns Photos" ) And
(Brand = colSelectedBrandName Or IsBlank(colSelectedBrandName)) And
('Work Order Status'.Value = colSelectedTStatusName Or IsBlank(colSelectedTStatusName))
),"SequenceNumber",SortOrder.Ascending,"NetworkName",SortOrder.Ascending))

 

now the sort will only work if i select "Created", while SequenceNumber or "NetworkName" will not show any data.. this problem  start to happen when the "Work Order" list exceeds 5,000 items. although the Created + Sequenceumber + Networkame are added as indexes inside the list.. now if i remove the second sort field this will work for all the options.. so why i can not do multiple sorts for the gallery items, even if those fields are been indxed?

 

here are the indexes:-

 

johnjohnPter_0-1717336560358.png

 

 

Thanks

Categories:
I have the same question (0)
  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    How many records are being returned? You could always just do the sort after you do your filtering using with() to get the records then sort those returned sets. 

  • johnjohnPter Profile Picture
    1,827 Season of Giving Solutions 2025 on at

    @cwebb365 With will only return 5000 items,,, i need the gallery to show all items as the user scroll down..

  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    That is not good practice to have more than 5000 items to scroll. Any single call in PowerApps cannot exceed more than 2000 records to begin with. If you are going to be doing large datasets of data you will want to look into fluentUI datalist / grid custom controls and utilize paging.

     

    But back to the original question, the only work around that might help in this case utilizing built in 100 record paging gallery controls SP might require a double index for that if only one column is working, in SharePoint when you create index you can pick a 2nd column on an index, not sure if you can pick those two columns, but that might the only option, outside of that you might be hitting delegation / datasource constraints. 

  • johnjohnPter Profile Picture
    1,827 Season of Giving Solutions 2025 on at

    @cwebb365 with gallery if you define the Items to be the sharepoint datasource, you can show all the items using the scroll option, you can show more than 2,000 or 5,000 items this is the nature of the gallery if you do not use any collections..

     

    for creating a second column inside the same index, as you can see i already defined 20 indexes (which is the maximum number of indexes).. and i need all of them.. so if i define single index to have the Sequence then NetworkMame.. will this work if i do a sort using the Sequence only? or i will need to have 2 indexes once with the Sequence column only and the second for the Sequence + the NetworkName?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 361

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard