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 / adding a sort by to a ...
Power Apps
Unanswered

adding a sort by to a gallery with search and filter

(0) ShareShare
ReportReport
Posted on by 201

I would like to add a couple sort by columns for a name column and a date column but am struggling with where to insert it. This is the items property of my gallery and is working at the moment. Before or after filter then where to add my fields in this. Any help is appreciated!

 

 

Filter(
 Search(
 Search(
 Search(
 AddColumns(
 'NDT Cert Tracker',
 DisplayName,
 Name.DisplayName,
 ExaminerDisplayName,
 Examiner.DisplayName,
 SupervisorDisplayName,
 Supervisor.DisplayName
 ),
 txtName.Text,
 DisplayName
 ),
 txtExaminer.Text,
 ExaminerDisplayName
 ),
 txtSupervisor.Text,
 SupervisorDisplayName
 ),
 (cbxMethod.Selected.Value = Method.Value || IsBlank(cbxMethod.Selected.Value)),
 (cbxLevel.Selected.Value = Level.Value || IsBlank(cbxLevel.Selected.Value)),
 (cbxLocation.Selected.Value = Location.Value || IsBlank(cbxLocation.Selected.Value))
)

 

 

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

    Hi @ScablandsKing ,

    The exact formula will change depending on what you want to sort by, but lets say for example you have a 'SortBy' dropdown ('ddSortBy') with values like name and date, and a toggle for ascending/descending order ('tglSortOrder'):

    SortByColumns(
     Filter(
     Search(
     Search(
     Search(
     AddColumns(
     'NDT Cert Tracker',
     "DisplayName", Name.DisplayName,
     "ExaminerDisplayName", Examiner.DisplayName,
     "SupervisorDisplayName", Supervisor.DisplayName
     ),
     txtName.Text, "DisplayName"
     ),
     txtExaminer.Text, "ExaminerDisplayName"
     ),
     txtSupervisor.Text, "SupervisorDisplayName"
     ),
     (cbxMethod.Selected.Value = Method.Value || IsBlank(cbxMethod.Selected.Value)) &&
     (cbxLevel.Selected.Value = Level.Value || IsBlank(cbxLevel.Selected.Value)) &&
     (cbxLocation.Selected.Value = Location.Value || IsBlank(cbxLocation.Selected.Value))
     ),
     If(ddSortBy.Selected.Value = "Name", "DisplayName", 
     If(ddSortBy.Selected.Value = "Date", "DateColumn", "DisplayName")),
     If(tglSortOrder.Value, SortOrder.Ascending, SortOrder.Descending)
    )

    ------------------------------------------------------------------------------------------------------------------------------
    If I answered your question, please accept my post as a solution and if you liked my response, please give it a thumbs up.

    Thanks!

  • ScablandsKing Profile Picture
    201 on at

    @kelseytran Thanks! Super helpful!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard