web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Check if record exist ...
Power Apps
Answered

Check if record exist in (dynamic) gallery

(0) ShareShare
ReportReport
Posted on by 41

I have two screens:

Screen 1- Have details of item (item name and item image) and button, when I press the button (add to cart) it adds the item name and image to the gallery (colProducts) on another screen.

Screen 2- Have gallery (colProducts) that display all items added to gallery that's coming from the add to cart button on screen 1.

 

I want to do a check first on the button on screen 1 to check if the item I am about to add already exist in the gallery (colProducts).

The current code I have on the button is "Collect(colProduct, {itemName: thisTitle, itemImage: thisImage})"

This adds the current item to the gallery but when I press the button again, it adds another duplicate entry to the gallery.

How can I check using an if statement if the record already exist?

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Johnane ,

     

    Please try:

    If(
     IsBlank(Filter(colProduct,itemName=thisTitle)),
     Collect(colProduct, {itemName: thisTitle, itemImage: thisImage})
    )

     

    Best Regards,

    Bof

  • Verified answer
    RahulAnsari Profile Picture
    58 on at

    Hi,@Johnane 

    Try This Code 

     

    If(!IsBlank(LookUp(ColProduct,ItemName=txtDetailItemName.Text)),Notify("Allready Exist",NotificationType.Error),Collect(
    ColProduct,{
     ItemName:txtDetailItemName.Text,
     Image:txtDetailItemImage.Text
    }))

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard