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

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

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

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

Highlighted

No worries. Glad it worked 🙂

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 (13,222)