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
Highlighted
Dual Super User III
Dual Super User III

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
Highlighted
Dual Super User III
Dual Super User III

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!

Highlighted
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.

Highlighted
Dual Super User III
Dual Super User III

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!
Highlighted
Anonymous
Not applicable

Re: Search and Sorting button

@yashag2255 

 

Hey!

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

Highlighted
Responsive Resident
Responsive Resident

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

Highlighted
Anonymous
Not applicable

Re: Search and Sorting button

@PavanKumar 

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

Highlighted
Dual Super User III
Dual Super User III

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

Highlighted
Responsive Resident
Responsive Resident

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,828)