cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Search and Sorting button

How to setup sorting button in the PowerApps.

 

I have this code for sorting according to the recieving date column in table. but, it doesn't works.

UpdateContext({SortDescending1: !SortDescending1, SortPriority: "ReceivedDateTime"})

What should i do for search thing?

 

Thank You!

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Search and Sorting button

@Anonymous 

 

Can you please confirm if the UpdateContext is getting triggered? Where have you kept this value? You can verify this by checking View -> Variables -> SortDescending1
 
This needs to be triggered at some point to sort the results.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

8 REPLIES 8
Dual Super User
Dual Super User

Re: Search and Sorting button

Hi @Anonymous 

 

The expression that you have used is not affecting the results that you are displaying, it is just creating a variable for reference to set the sort order.
You can update the expression as:
 
UpdateContext({SortDescending1: !SortDescending1})
 
Now, suppose you are using a gallery to display results, and a text Input(TextInput1) to enter search criteria.
 
Gallery -> Items: Sort(Search(DataSourceName,TextInput1.Text,"abcd_Col1","abcd_Col2"),"ReceivedDateTime",If(SortDescending1,Descending,Ascending))
 
Here, in Search function you can add all the columns you want to search the value in. I have just used Col1 and Col2 for reference.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Anonymous
Not applicable

Re: Search and Sorting button

@yashag2255 

 

Hey! I am getting this warning:

 

Deegation warning. The "sort" part of this formula might not work correctly on large data sets.

Dual Super User
Dual Super User

Re: Search and Sorting button

Hey @Anonymous 

 

Can you please confirm the number of items in your data source? If the number of items is less than 2000, then you can do the below setting and ignore the warning:
 
App Settings -> Advanced Settings -> Data Row limit for Non-Delegable Queries -> 2000.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Anonymous
Not applicable

Re: Search and Sorting button

@yashag2255 

 

Hey!

The sorting button doesn't works though. Search Items is working fine.

PavanKumar
Level 8

Re: Search and Sorting button

HI,

 

What color line is it showing under the formulae.

 

if it shows blue wavy line, It means it still works (not a red wavy line but a blue wavy line) if the table contains fewer than 500 records, the formula worked perfectly.

 

But if the table contains more than 500 records, the formula won't return record 501 or higher, even if it matches the criteria.

 

So the Max result here may be an error if table contains more than 500 records.

 

However 500 is the default number of records, but you can change this number for an entire app:

 

On the File tab, select App settings.

 

Under Experimental features, change the Data row limit for non-delegable queries setting from 1 to 2000. For more details about Delegation warnings please check this link: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

 

 

if this answers your question, give a thumbs up and mark it as verified.

Regards,

Pavan Kumar Garlapati

Anonymous
Not applicable

Re: Search and Sorting button

@PavanKumar 

But, when i click sort button nothing happens in the app. 

Dual Super User
Dual Super User

Re: Search and Sorting button

@Anonymous 

 

Can you please confirm if the UpdateContext is getting triggered? Where have you kept this value? You can verify this by checking View -> Variables -> SortDescending1
 
This needs to be triggered at some point to sort the results.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

PavanKumar
Level 8

Re: Search and Sorting button

HI,

 

As Yash mentioned.

The moment UpdateContext({SortDescending1: !SortDescending1}) triggered it sets the variable value. you can see the variable value in files --> variables --> SortDescending1. For instance set the formulae onvisible of the screen (whichever you are working on) and check.

 

Regards,

Pavan Kumar Garlapati

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,662)