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 / Incompatible Types for...
Power Apps
Answered

Incompatible Types for Comparison Issue

(0) ShareShare
ReportReport
Posted on by 36

Hi All,

 

I'm working on Power Apps and I want to filter out a gallery by status = Submitted but exclude any records in which the current user (the approver) is already listed as Approver. I'm not sure why, but when I use =!, I get a "incompatible Types for Comparison" error but not if I just use "=".


Here is the code that I want:

 

SortByColumns(Filter(Requests, ReqStatus="Submitted", Approver=!varUserName), "ID",Descending)

 

This code does not work. But if I make Approver = varUserName, it works.

 

SortByColumns(Filter(Requests, ReqStatus="Submitted", Approver=varUserName), "ID",Descending)

 

What I am missing here? I want to avoid any operator that is non-delegable.

 

Thanks,

 

Categories:
  • BCLS776 Profile Picture
    8,994 Moderator on at

    The ! operator works with boolean variables. Have you tried Approver <> varUserName instead?

    Hope that helps,

    Bryan

  • Robert_ Profile Picture
    36 on at

    Thanks for the reply. I must be doing something wrong because it is not accepting !.  See attached.

    I want to avoid <> because it is not delegable. My SP list will eventually exceed 2,000 rows.

    Screenshot 2023-02-19 at 2.22.21 PM.png
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    You cannot use the ! operator on a variable that contains a string - that's why you're seeing an error.

    To help with delegation on a SP list, try using a With() to pre-filter and then filter out all records that match varUserName:

    With({aFilter: 
     SortByColumns(
     Filter(Requests, ReqStatus="Submitted"), 
     "ID",
     Descending
     )},
     Filter(aFilter, Approver <> varUserName)
    )

    This should work as long as the total number of records with a ReqStatus = "Submitted" is less than the non-delegable query limit of the app.

    Bryan



  • Robert_ Profile Picture
    36 on at

    Thanks a million @BCLS776. That seems to work. And yes, I anticipate that ReqStatus = "Submtted" will always be less than the non-delegable query limit!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard