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

How to Filter, sort by date and search by searchbox a gallery

Dear all,

I am a new user of powerapps and I really need someone very experienced to help me with 2 Filtering issues that I have. I would really appreciate it if you take some time to look into my case.

First I should mention that I am working with A SharePoint List. This List shows the rollout appoinments of employees. I am now creating a powerapp that has several screens. 

XT2_2-1605859220274.png

Sort(Filter(Termine,Text(Startzeit,"[$-en-GB]mm/dd/yyyy")=Text(Today(),"[$-en-GB]mm/dd/yyyy"),Techniker.Email=VarUser.Email),Startzeit,Ascending)

 

this screen shows the appointments that are for the techniker(technician) only for today and I am sorting from the newer to the older appointment. Now the delegation here is not bothering me since they are deleting the old appointments. What I can not figure out is how I can include my searchbox in the code. I have tried the startswith but then I do not receive any data at all on the Gallery.

And I have a similar issue in the second screen, where I want the technician to look at all his appointments that are current(also future) and not old (I know I wrote that they are deleting them but it takes them some weeks to do so)

XT2_3-1605859252269.png

SortByColumns(Filter(Termine,Techniker.Email = VarUser.Email,Startzeit >= Now(),StartsWith(Title, Searchtextbox.Text)), "Title",Ascending )

This is a picture with my code. Here I manage to add the searchbox but when I open the screen I do not receive any data, I need to write something in the searchbox first and then it will load all the current appointments. Now for your understanding, the Starzeit(start time) and Endzeit(end time) are both date and time columns.

 

Could you please help me with that issue?

1 ACCEPTED SOLUTION

Accepted Solutions
mchrzanowski
Frequent Visitor

Hello,

 

PowerApps have Search() function, which can be used for what you need. Syntax for your function would look something like this:

Sort(Search(Filter(Termine,Text(Startzeit,"[$-en-GB]mm/dd/yyyy")=Text(Today(),"[$-en-GB]mm/dd/yyyy"),Techniker.Email=VarUser.Email),Searchtextbox.Text,*searched column*),Startzeit,Ascending)

 

You can search by multiple columns, just after comma add another column name.

 

Keep in mind that Search function can only be applied to text data. If you want to search by date, I'd recommend just adding another logical test to filter, but instead of using StartsWith, try In:

Sort(Filter(Termine,Text(Startzeit,"[$-en-GB]mm/dd/yyyy")=Text(Today(),"[$-en-GB]mm/dd/yyyy"),Techniker.Email=VarUser.Email, Searchtextbox.Text in Startzeit),Startzeit,Ascending)

 

Hope it helps!

View solution in original post

2 REPLIES 2
mchrzanowski
Frequent Visitor

Hello,

 

PowerApps have Search() function, which can be used for what you need. Syntax for your function would look something like this:

Sort(Search(Filter(Termine,Text(Startzeit,"[$-en-GB]mm/dd/yyyy")=Text(Today(),"[$-en-GB]mm/dd/yyyy"),Techniker.Email=VarUser.Email),Searchtextbox.Text,*searched column*),Startzeit,Ascending)

 

You can search by multiple columns, just after comma add another column name.

 

Keep in mind that Search function can only be applied to text data. If you want to search by date, I'd recommend just adding another logical test to filter, but instead of using StartsWith, try In:

Sort(Filter(Termine,Text(Startzeit,"[$-en-GB]mm/dd/yyyy")=Text(Today(),"[$-en-GB]mm/dd/yyyy"),Techniker.Email=VarUser.Email, Searchtextbox.Text in Startzeit),Startzeit,Ascending)

 

Hope it helps!

View solution in original post

XT2
Frequent Visitor

Thank you it looks like it is working, what about the second screen? I am doing the same but it is not working properly, even though I should see 4 appointments in my Gallery (which I see), but when I try to use the searchbox I do not receive data at all

This is my formula: Sort(Search(Filter(Termine, Startzeit >= Now(),Techniker.Email = VarUser.Email),Searchtextbox.Text, "Title"), Startzeit,Ascending )

XT2_0-1605968995377.png

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,626)