Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Problem comparing current list choice in form with current default

(0) ShareShare
ReportReport
Posted on by 714 Super User 2025 Season 1

I have a bunch of If checks at a form submission to determine if fields have been modified. I'm sure there are better ways to do this but I have this working for all but one field which is a choice field. I cannot for the life of me figure out how to do the comparison.

 

Here is my code (I know it's currently wrong. I can't compare a text string to a record but removing the .DisplayName on the left to compare records fails. And I can't use .DisplayName on the datacard default which is also referencing a user from a choice list.

 

If(
 DataCardValue12.Selected.DisplayName <> crdAssignedUser2.Default, // Check if the Assigned To has been changed
 Patch(
 ActEntry, // Specify the target data source (ActEntry table)
 Defaults(ActEntry), // Create a new record
 {
 TicketNumber: RequestID, // Use the same TicketID formula the Details Form does
 Activity: "Assigned",
 Entry: DataCardValue12.Selected.DisplayName, // Write the new value of the Assigned To
 Datetime: Now(),
 User: User().FullName
 }
 )
);

 

DataCardValue12.Selected <> crdAssignedUser2.Default doesn't work. This one doesn't show an error on either side but it shows error at the <>. 

 

DataCardValue12.Selected.DisplayName <> crdAssignedUser2.Default.DisplayName doesn't work. The right side shows an error for .DisplayName. Although that Default is a record that does resolve to a user, I can't get 'inside' the record to do the comparison here.

 

 

 

Categories:
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Problem comparing current list choice in form with current default

    Thank you.  This works:

     

    If( DataCardValue12.Selected.Email <> LookUp(Tickets, ID = varItem, AssignedUser).Email,
  • Verified answer
    BhargavPatel Profile Picture
    628 Super User 2025 Season 1 on at
    Re: Problem comparing current list choice in form with current default

    @DCHammer haha it’s all good. We all have been in the same boat. 
    I meant to say replace <FormItemProperty> with the code that is in Item property of the Form. Sorry I wasn’t very clear. 

  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Problem comparing current list choice in form with current default

    I'm not clear on what belongs in the <FormItemProperty>. It's often amazing to me how long it takes me to figure out what should be a simple value comparison. Makes me question my own sanity. 😉

  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Problem comparing current list choice in form with current default

    That doesn't work. It compares a text string to a record. Appreciate the assist though.

  • vkondreddygari Profile Picture
    81 on at
    Re: Problem comparing current list choice in form with current default

    try with below - 

     

    !(DataCardValue12.Selected.DisplayName = crdAssignedUser2.Default)
  • BhargavPatel Profile Picture
    628 Super User 2025 Season 1 on at
    Re: Problem comparing current list choice in form with current default

    @DCHammer To check if any fields in a Form were modified, you can use Form.Unsaved function which will give you a boolean value.

    If people picket is not a multi-choice field, then to compare the value in Form to the value in the database try this:

    DataCartValue12.Selected.Email <> <FormItemProperty>.<ColumnName>.Email

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard