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; Editing Items in a Collection Stops Working

(0) ShareShare
ReportReport
Posted on by 22

I'm trying to build an app like this Shane Young video. I have a data entry screen that feeds to a collection, then a review screen where a user can edit each line from that collection. Initially everything works great. However, at some point the five inputs all have yellow triangle errors and say:

 

Incompatible types for comparison. The left value is a Text and the right value is a Boolean.

 

We can't evaluate your formula because the values being compared in the formula aren't the same type.

 

Location: [Input Name].DisplayMode

 

This happened before and I rewrote everything and it worked before failing again. The review page has the following:

 

Edit Toggle

Creates a variable to turn editing off and on.

OnCheck - Set(Edit, true)

OnUncheck - Set(Edit, false)

 

Five Inputs (two drop downs, three texts)

If(Edit = true, DisplayMode.Edit, DisplayMode.View)

 

I also have a Patch function that overwrites those five inputs in the collection. I originally had it on a back button, but thought it might work on the Uncheck for the Toggle. Here's that:

 

Patch(Collection1,Gallery3.Selected,{AssetType:AssetType_Input_Review.Selected.AssetType,AssetName:AssetName_Input_Review.Text,InspectionMethod:InspectionMethod_Input_Review.Selected.InspectionMethod,MP_Start:MPStart_Input_Review.Text,MP_End:MPEnd_Input_Review.Text})

 

I'm learning this as I go, so any help is greatly appreciated.

 

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Robey-WanKenobi 

    You are using a name that is confusing PowerApps.  That is "Edit".  The formula editor is inferring that Edit in that formula is really DisplayMode.Edit (which is a text value).

    So, your formula is trying to compare Edit (text) to true (Boolean).

     

    Get rid of the variable.  This is PowerApps...not development.  You already have a Boolean "variable" that will determine if it is in edit mode - your Toggle!

    So, get rid of the OnCheck and UnCheck action formulas and replace your DisplayMode property formulas with this:

        If(yourToggle.Value, DisplayMode.Edit, DisplayMode.View)

     

    When your toggle is on, they will be in Edit mode. When off, in View mode.

    No variables needed.

     

    I hope this is helpful for you.

  • Robey-WanKenobi Profile Picture
    22 on at

    That solved it exactly and is a much simpler solution. Like I said, I'm learning as I go, so I copy what I can find and had no idea there was a much better way.

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

    @Robey-WanKenobi 

    Very good!!  Yes, the key in PowerApps is to think about how you would "develop" something you want to do, and then completely forget about it.  Keep it Super Simple.  Reference everything (your controls) in your app as much as you can.  Stay away from variables as much as you can.  Stay away from "Onxxxx" actions as much as you can.

    Now, I say "as much as you can" because these are not bad things, and there is a use for them all, but the more you think in terms of reference rather than action, the easier it will all be.

     

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard