cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arigl
Level: Powered On

Filter or Sort won't work

I use a 4 column Sharepoint list h0_1, in which a user can input data. Patch operation (1st  screen) works fine, however sort function won't work. This is a very small list (<<500).

 

 

 

ClearCollect(Aent, {DateSmiley Very HappyatePicker2.SelectedDate,Title:TextInput1.Text, Ar:Value(1),Dep:Value(1)});TextInput1.Text=Text("Date");
Patch(h0_1,Defaults(h0_1),Last(Aent));
SortByColumns(h0_1,"Date")

 

In Screen2 I  use a Gallery. I want to filter its data by seleced date from DatePicker1.

 

Filter(h0_1, Text(Label1.Text)=Text(DatePicker1.SelectedDate,"[$-en-US]dd-mm-yyyy" ))

 

This does not work.f1.pngf0.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Filter or Sort won't work

The Filter and SortByColumns functions do not change the collection/list to which they are applied. Instead, they return a new table that is filtered / sorted based on the arguments instead.

 

You should update the Items property of your gallery to use the Filter / Sort functions there. For example, in the Gallery1, on Screen2, you can have this expression for the Items property:

Filter(h0_1, Label1.Text = Text(DatePicker1.SelectedDate,"[$-en-US]dd-mm-yyyy" ))

Likewise for the sort operation - you use that function in the place where you want the data sorted.

2 REPLIES 2
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Filter or Sort won't work

The Filter and SortByColumns functions do not change the collection/list to which they are applied. Instead, they return a new table that is filtered / sorted based on the arguments instead.

 

You should update the Items property of your gallery to use the Filter / Sort functions there. For example, in the Gallery1, on Screen2, you can have this expression for the Items property:

Filter(h0_1, Label1.Text = Text(DatePicker1.SelectedDate,"[$-en-US]dd-mm-yyyy" ))

Likewise for the sort operation - you use that function in the place where you want the data sorted.

arigl
Level: Powered On

Re: Filter or Sort won't work

Thanks

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 224 members 4,697 guests
Please welcome our newest community members: