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 / Problem comparing curr...
Power Apps
Answered

Problem comparing current list choice in form with current default

(0) ShareShare
ReportReport
Posted on by 716 Moderator

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:
I have the same question (0)
  • BhargavPatel Profile Picture
    660 Moderator on at

    @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

     

  • vkondreddygari Profile Picture
    88 on at

    try with below - 

     

    !(DataCardValue12.Selected.DisplayName = crdAssignedUser2.Default)
  • DCHammer Profile Picture
    716 Moderator on at

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

  • DCHammer Profile Picture
    716 Moderator on at

    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. 😉

  • Verified answer
    BhargavPatel Profile Picture
    660 Moderator on at

    @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
    716 Moderator on at

    Thank you.  This works:

     

    If( DataCardValue12.Selected.Email <> LookUp(Tickets, ID = varItem, AssignedUser).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

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard