cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
richardcampbell
Frequent Visitor

BrowseGallery1 not sorted correctly and SortByColumns not working all

I'm making an IT asset list and creating a PowerApp to sort and edit existing list items and add new items to the list.

 

BrowseScreen1 Fields:

  • Body1 = Availability
    • Display value = Value
  • Subtitle1 = User
    • Display value = DisplayName
  • Title1 = ThisItem.'Asset Number'

The Asset Number field in my SharePoint list is Number

 

BrowseGallery1.Items = SortByColumns(Filter([@'Asset List'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

The items are showing up in the PowerApp, just not sorted by Asset Number as I was hoping. 

 

I also have a TextSearchBox1.Default = " "

It's format is Text

 

When I enter anything in the Search items field my list goes blank...

18 REPLIES 18

That's probably because of User.'Full Name'.

What fields exist in your User lookup? I assumed Full Name is one.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

If I use this code I can get it to find the Asset Number I input into the "Search items" field:

 

SortByColumns(Filter([@'Asset List'], StartsWith(Text('Asset Number'), TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

It still does not sort the list by asset number when the "Search items" field is left blank.

If you are expecting it to be sorted by Asset Number, I am not sure how it would since the column you are specifying for sort is Title.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Agree, but if I put 'Asset Number" or Text('Asset Number') in the place of "Title", it does not show any list items.

So your only issue with this formula is that it doesn't sort, correct? 

 

Please try this to sort by Asset Number: 

 

SortByColumns(Filter(AddColumns('Asset List', "AssetNumberText", Text('Asset Number')), StartsWith(Text('Asset Number'), TextSearchBox1.Text)), "AssetNumberText", If(SortDescending1, Descending, Ascending))

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

 

View solution in original post

Doesn't do exactly what I want but it can be remedied by going and making the asset numbers all a five digit number, for example 00056, this is organizing 56 with 562. Thanks for the help Hardit!

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

Thanks!
Hardit Bhatia
https://thepoweraddict.com

This does not work for me. I was hoping to get my gallery sorted on ticket ID but it does its own thing, unfortunately. Any suggestions? 

 

SortByColumns(Search(Filter('OCS-Tickets','Created By'.'Full Name' = User().FullName,'OCS-Tickets_Status'<>"Closed"),TextSearchBox1_4.Text,"cr8d9_ocstickets_id","cr8d9_ocstickets_industry","cr8d9_ocstickets_dataset","cr8d9_ocsticket_sub_type_1","cr8d9_ocsticket_sub_type_2","cr8d9_ocstickets_country","cr8d9_ocstickets_region","cr8d9_ocstickets_detail","cr8d9_ocstickets_data_type","cr8d9_ocstickets_urgency","cr8d9_ocstickets_assignee","cr8d9_ocstickets_group","cr8d9_ocstickets_inquiry_type","cr8d9_ocstickets_status","cr8d9_ocstickets_client"),"cr8d9_ocs_ticketsid",If(SortDescending1,Descending,Ascending))

Rashid_NPD
Frequent Visitor

This does not work for me. I was hoping to get my gallery sorted on ticket ID but it does its own thing, unfortunately. Any suggestions? 

 

SortByColumns(Search(Filter('OCS-Tickets','Created By'.'Full Name' = User().FullName,'OCS-Tickets_Status'<>"Closed"),TextSearchBox1_4.Text,"cr8d9_ocstickets_id","cr8d9_ocstickets_industry","cr8d9_ocstickets_dataset","cr8d9_ocsticket_sub_type_1","cr8d9_ocsticket_sub_type_2","cr8d9_ocstickets_country","cr8d9_ocstickets_region","cr8d9_ocstickets_detail","cr8d9_ocstickets_data_type","cr8d9_ocstickets_urgency","cr8d9_ocstickets_assignee","cr8d9_ocstickets_group","cr8d9_ocstickets_inquiry_type","cr8d9_ocstickets_status","cr8d9_ocstickets_client"),"cr8d9_ocs_ticketsid",If(SortDescending1,Descending,Ascending))

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,033)