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

Removing items from gallery if user has already submitted a form for that item

I have two SharePoint lists, one has a list of documents and another has a list of user's submissions for those documents. My first powerapp screen is a gallery of all of the documents in the list. The user then selects a document to review and give it a grade. I only want my users to be able to submit a review for each document once. I am looking for a way to filter items out of the gallery IF there is a record in the submissions list that has the document title, and was submitted by the currently logged in user.

 

I basically want to do a "If a record with X title exists in Y list and was also created by Z user, do not show in Gallery"

 

Seems like it will be a really complicated filter but not sure if I am missing an obvious solution?

 

Appreciate any help.

1 REPLY 1
BrianS
Super User
Super User

The easiest way may be to create a Collection of all the documents to be graded, and then remove the ones the user has already graded. When the app starts create the Collection of all the documents. Then capture the user with the User function or the Office 365 User connector - it will depend how you are designating the user in the "grading" list. Then create a collection of the documents they have already graded. The run a RemoveIf function on the first collection looking at the grading list users to see which they have already reviewed.

Here is the documentation for RemoveIf:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif

Your code will be something like:

Set(var_User, User());

ClearCollect(Col_Docs,DocList);

CleartCollect(Col_Grades,Filter(GradeList,var_User.Email=EmailAddress));

RemoveIf(Col_Docs,Col_Grades.DocName=Col_Docs.DocName)

 

You will need to adjust depending on your list and field names.

 

 

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
Users online (1,500)