cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,862)