cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Prevent duplicates when adding to one collection from another?

I have a list of students. My parents find their student and add them to a list for sign-out, they may have multiple children. The problem is I am trying to prevent them adding the same child more than once. In my master list I have an icon in a gallery that says:

Collect(Roster, ThisItem)

Roster is my collection to process for sign-out. I tried this:

If(IsBlank(LookUp(Roster,'User ID'=ThisItem.'User ID')),Collect(Roster, ThisItem))

This always returns the first (and usually only) record no matter what so it blocks adding a second student. I am trying to check if the record to be added is already in list and if so prevent duplicating? Any suggestions?

4 REPLIES 4
Highlighted
Impactful Individual
Impactful Individual

Re: Prevent duplicates when adding to one collection from another?

where are you putting this if statement? If the item isn’t created yet then I don’t think this item is going to return anything. You should be trying to compare it to the text value of the user if control?
Highlighted
Post Patron
Post Patron

Re: Prevent duplicates when adding to one collection from another?

I have a gallery for the from collection and there is an icon in each item and that code is in the OnSelect section. The problem is as soon as I add one item the LookUp always returns true. It seems like the LookUp is returning something even when it shouldn't be?

Highlighted
Resolver II
Resolver II

Re: Prevent duplicates when adding to one collection from another?

@BrianHFASPS  as @cwebb365  mentioned what's probably happeing is the ID of the collection you are in has an ID that matches the ID of the Roster but not the same person. You should try some other unique value such as If(IsBlank(Lookup(Roster,'First Name' = ThisItem." First Name' && 'Last Name'=ThisItem.'Last Name' && DOB=ThisItem.DOB)),Collect(Roster, ThisItem))

 

 

------------------------------------------------------------------------------OfficePowerUser.com------------------------------------------------------------------------ 
If this post helps answer your question, please click on “Accept as Solution” to help other members. If you thought this post was helpful, please give it a Thumbs Up. 

 

Highlighted
Post Patron
Post Patron

Re: Prevent duplicates when adding to one collection from another?

The User ID field is my unique identifier and key in SQL table the colleciton is built from. The problem seems to be the statement doesn't see a blank response from lookup if the roster collection has anything in it? It is like the lookup is returning some non-blank table?

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,063)