cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Gallery Search/Filter Issue

I apologize if this has been covered in another post, but I've been searching heavily and can't find a solution.

 

I have a gallery set up and the items populate from one list (DataCollection), but I want to filter those inputs based on a control text input (TraineeName) and whether that text is present for an item in a secondary list (CompletedTasks) so that if a task from DataCollection has been completed by a specific TraineeName (where it is recorded in CompletedTasks) it will not appear in the gallery with the remaining items from DataCollection.

 

Any insights?

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Gallery Search/Filter Issue

Hi @LHuber ,

 

I have managed to recreate your solution using collections for your tables, a dropdown box to select the employee and some sample data in both of these. I have managed to achieve what I believe you required by using the following code to filter the Items in the "Datacollection" Gallery:

 

Filter(Datacollection,Not(Task in Filter(completedtasks,TraineeName=Dropdown1.Selected.Value).Task))

 

You may have to change some of the field names as I wasn't sure on all of your naming conventions but lets break it down. We are essentially using a filter within a filter.

 

The first filter is the inner filter on the completed tasks table. We want to filter that table for records that the Trainee has completed by using the following code:

Filter(completedtasks,TraineeName=Dropdown1.Selected.Value)

That will leave us with a filtered list of completed tasks by the Trainee we have selected in the dropdown box. This of course assumes you are using a dropdown box to select the employee otherwise you need to change the value after the "=" sign.

 

Now we have a list of tasks they have completed we can use this filter as part of a bigger filter on the DataCollection Gallery.

We now need to show tasks that are NOT in the first filter. We achieve this by the following code:

Filter(Datacollection,Not(Task in X.Task))

Where X is the first filter.

 

Hope this helps but please let me know if you have any further questions.

 

Thanks

Amar

 

View solution in original post

3 REPLIES 3
Highlighted
Frequent Visitor

Re: Gallery Search/Filter Issue

Hi @LHuber ,

 

I have managed to recreate your solution using collections for your tables, a dropdown box to select the employee and some sample data in both of these. I have managed to achieve what I believe you required by using the following code to filter the Items in the "Datacollection" Gallery:

 

Filter(Datacollection,Not(Task in Filter(completedtasks,TraineeName=Dropdown1.Selected.Value).Task))

 

You may have to change some of the field names as I wasn't sure on all of your naming conventions but lets break it down. We are essentially using a filter within a filter.

 

The first filter is the inner filter on the completed tasks table. We want to filter that table for records that the Trainee has completed by using the following code:

Filter(completedtasks,TraineeName=Dropdown1.Selected.Value)

That will leave us with a filtered list of completed tasks by the Trainee we have selected in the dropdown box. This of course assumes you are using a dropdown box to select the employee otherwise you need to change the value after the "=" sign.

 

Now we have a list of tasks they have completed we can use this filter as part of a bigger filter on the DataCollection Gallery.

We now need to show tasks that are NOT in the first filter. We achieve this by the following code:

Filter(Datacollection,Not(Task in X.Task))

Where X is the first filter.

 

Hope this helps but please let me know if you have any further questions.

 

Thanks

Amar

 

View solution in original post

Highlighted
Regular Visitor

Re: Gallery Search/Filter Issue

I embedded this within my Search function and it works perfectly.  Thank you!!

Highlighted
Frequent Visitor

Re: Gallery Search/Filter Issue

No worries. Glad it worked 🙂

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,848)