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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / COMPARISON BETWEEN TWO...
Power Apps
Answered

COMPARISON BETWEEN TWO FIELDS OF PEOPLE OR GROUP THAT CANNOT BE EQUAL

(0) ShareShare
ReportReport
Posted on by

I have two fields of the type "person and group" and the user will not be able to select the same in the two fields, I tried to search a solution for this comparison, did not find and think of nothing, how would this be done?

Example:

 

I have a field called "admin" and the other one "manager", and both cannot be the same person, if the user selects: "Admin A" in the "Admin" field, in the "manager" field, he cannot select "Admin A", an error screen will appear, or something from type informing this to the user

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Gorilla_8 

    You'll need to supply a little more information on your scenario.  I will make the assumption that you have an EditForm with these two columns and provide some answer to that.

    Let's say you have EditForm1 and it has an Admin column and a Manager column.

    I would recommend disabling the submit button, but you can adapt that to whatever your needs are.

    If(EditForm1.Updates.Admin.Email = EditForm1.Updates.Manager.Email, Disabled, Edit)

     

    If your scenarios is vastly different, then provide a few more details on the controls you have.

     

    I hope this is helpful for you.

  • Gorilla_8 Profile Picture
    on at

    Hi, @RandyHayes 

     

    Thanks for the answer! 😄 And you already gave me some ideas that I will test on my App, what information would you like?

     

    Suppose it is what type of form?

     

    It will be in mode: New and Edit

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Gorilla_8 

    Okay, so your response answered the question that I had...was this a Form?  It appears as though you are definitely using a form.

    Were you able to apply the proposed solution I gave in my response?

  • Gorilla_8 Profile Picture
    on at

    Hi @RandyHayes 

     

    Unfortunately not, the solution does not work correctly for me. 😞

    I set the logged-in user's email as default, but I would like to make this comparison if he chooses both the same, "SubmitForm" was not possible

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Gorilla_8 

    So what are you getting? An error? No function? What's going on that is not working?

  • Gorilla_8 Profile Picture
    on at

    Hi @RandyHayes 

     

    I need to show an error if the same user selects the field on the side instantly, not disabled my submit button or my form

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Gorilla_8 

    Some like to use the Notify function, personally I never use this as it is not part of modern app design.

    So, you can make that choice or, like I usually do, I would put a label on the screen (let's call it lblBadUser).

    I would set the text property to "Cannot choose the same name". And the color to Red

    I would set the Visible property of the Label to : 

    EditForm1.Updates.Admin.Email = EditForm1.Updates.Manager.Email

    Then, I would also combine this with the Submit Button DisplayMode property:

    If(lblBadUser.Visible, Disabled, Edit)

     

  • Gorilla_8 Profile Picture
    on at

    Hi @RandyHayes 

    Nice! Thank you for the help! 

    One more knowledge learned ... Just one more question about this requirement ...

     

    If I want to place this comparison and reset the fields in the field's "Reset" property, how do I do this?

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Gorilla_8 

    No problem!

     

    I'm not sure I am following what you mean by resetting the field.  What do you want to reset and when?

  • Gorilla_8 Profile Picture
    on at

    Hi @RandyHayes 

     

    On the card is a property "Reset", to reset a card

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard