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 / How to check if values...
Power Apps
Answered

How to check if values in text box match data source

(0) ShareShare
ReportReport
Posted on by 55

Hello all!

 

So I have an application where a user inputs the phone number of a customer to save in the database, but having duplicate phone numbers is not allowed. I figured out how to warn the user that the phone number already exists using If function, but I would also like to show the user in a gallery all the information of the customer's typed phone number (Name, Notes, Email, Phone: All this information is present in a data source.) and this should be done only after clicking a button. This button is the same that warns the user about a duplicate find.

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    @sergeasmar97 ,

    Going back to your previous post - one modification

    UpdateContext(
     {
     varLead:
     LookUp(
     Leads,
     LeadPhone=txtContactPhone.Text
     )
     }
    );
    If(
     !IsBlank(varLead.LeadPhone),
     Notify("Warning, phone number found. Submit again?",Information);
     UpdateContext({varResubmit:true}),
     Patch(
     Leads,
     Defaults(Leads),
     {LeadPhone:txtContactPhone.Text}
     );
     UpdateContext({varResubmit:false})
    )

    All the details could then be shown on labels - varLead.Name, varLead.Notes, varLead.Email, varLead.LeadPhone

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • sergeasmar97 Profile Picture
    55 on at

     

    Hey thanks man 🙂   you've been huge help. 

    This works perfectly, however, what if I need it to show all records of same number? Sometimes, duplicates are allowed, and I would like to show the user those records as well. Tried using a gallery but it didn't work. Only showed 1 record.

  • WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    Hi @sergeasmar97 ,

    That is because LookUp only returns one record

    ClearCollect(
     colLeads:
     Filter(
     Leads,
     LeadPhone=txtContactPhone.Text
     )
    );
    If(
     CountRows(colLeads) > 0 ,
     Notify("Warning, phone number found. Submit again?",Information);
     UpdateContext({varResubmit:true}),
     Patch(
     Leads,
     Defaults(Leads),
     {LeadPhone:txtContactPhone.Text}
     );
     UpdateContext({varResubmit:false})
    )

    Your Gallery Items would then be colLeads and your Label Text ThisItem.Phone    . . .

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    Hi @sergeasmar97 ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • sergeasmar97 Profile Picture
    55 on at

    cheers dude! everything works perfectly 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard