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. These types cant be compared: Text, Table

(0) ShareShare
ReportReport
Posted on by 33

I'm trying to dynamically add text to some of my TextInput fields on my form and I'm not having any success. The issue I keep running into is the "Incompatible types for comparison" error. And really, I'm not trying to compare, I'm trying to set the text property of a form field.

 

I have a SharePoint list, LAB_NAMES and it contains the fields 'LAB NAME', which is a text field, and 'LAB OWNER' which is a person field (not all fields included for simplicity). I have a dropdown on the form that allows a user to select the lab name that they are interested in. When the user selects the lab name, I would like to create a variable or collection that contains the other fields in the record, for example: LAB NAME, LAB OWNER, LAB POC, etc...

 

I tried to create the collection via the OnSelect method of the dropdown:

Collect(colLABNAMES, Filter(LAB_NAMES, StartsWith('LAB NAME',Dropdown2.Selected.'LAB NAME')));

 

I believe that colLABNAMES collection should contain all the fields after the user selects a lab name.

 

After I create the collection, I try to update the text of the TextInput1.Text field :

TextInput1.Text = colLABNAMES.'LAB_x0020_OWNER'.

However i get the error "Incompatible types for comparison. These types cant be compared: Text, Table"

 

Here is the complete code from my Dropdown onSelect:

 

Collect(colLABNAMES, Filter(LAB_NAMES, StartsWith(LAB NAME',Dropdown2.Selected.'LAB NAME')));

TextInput1.Text = colLABNAMES.LAB_x0020_OWNER

 

So, when I submit the form, TextInput1.Text should contain the owner's name and that will be submitted to the SharePoint list.

Categories:
I have the same question (0)
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @myka that's not the way powerapps work. 

     

    Instead of TextInput1.Text = colLABNAMES.LAB_x0020_OWNER

     

    Use

     

    Set(varTextValue,colLABNAMES.LAB_x0020_OWNER)

     

    Set the Text property of Textinput1 to varTextValue

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • myka Profile Picture
    33 on at

    @PowerRanger I don't see a Text property available for TextInput1, so I set the Default property to varTextValue. I also defined the variable in at the App level OnStart method. That part works.

     

    I used the Set(varTextValue,colLABNAMES.LAB_x0020_OWNER) as you recommended, but instead I put in a string like this: Set(varTextValue,"Marshal"). That worked, however when I put in the colLABNAMES.LAB_x0020_OWNER value, it gave me the red squiggly underline with the message:

     

    "Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app". So there is something wrong with how I'm accessing that LAB OWNER field that is of type person.

     

    I think the issue is with my initial lab name filter statement. I assumed it returned a single record (containing the columns), but it looks like I'm returning a Table and assigning it to colLABNAMES. So, how do I fix that?

     

    Collect(colLABNAMES, Filter(LAB_NAMES, StartsWith(LAB NAME',Dropdown2.Selected.'LAB NAME')));

     

    FYI I'm populating the Dropdown2 drop down using the items property and this formula (I think the Table part is causing issues when trying to access field, but not sure how else to do it):

     

    Ungroup(
        Table(
            {LABMenuOptions: Table({'LAB NAME': Blank()})},
            If(labRole = "Owner",
            {LABMenuOptions: Filter(L_NAMES, 'LAB OWNER'.Email=varUserEmail).'LAB NAME'},
            {LABMenuOptions: L_NAMES.'LAB NAME'}
        )
        ),
        "LABMenuOptions"

    )

  • myka Profile Picture
    33 on at

    Ok, I keep trying different things but so I haven't achieved the results I'm trying to get. Here are the different variations that I have tried

     

    //UpdateContext({varCurrentRecordOwner: Filter(L_NAMES,StartsWith('LAB NAME',Dropdown2.Selected.'LAB NAME'),'LAB OWNER'.DisplayName)});//Reset(TextInput1)

    //Collect(colLABNAMES, Filter(LAB_NAMES, StartsWith('LAB NAME',Dropdown2.Selected.'LAB NAME')));
    //Collect(colLABNAMES, LookUp(LAB_NAMES, 'LAB NAME' = Dropdown2.Selected.'LAB NAME'));
    //Set(varHatter, LookUp(LAB_NAMES, 'LAB NAME' = Dropdown2.Selected.'LAB NAME'));
    //Set(varSelected,Dropdown2.Selected.'LAB NAME');

    //UpdateContext({
    // myRecord:LookUp(LAB_NAMES, 'LAB NAME' = Dropdown2.Selected.'LAB NAME')
    //})

     

    //This next one returns a single record when OnSelect is used with the dropdown, which is what I am expecting. But it doesn't update the Default value for my TextInput field (myRecord.'LAB NAME'), it isn't updating the Default values for any of my TextInput fields or Labels I've created.
    Set(
    myRecord,
    LookUp(LAB_NAMES, LAB_x0020_NAME = Dropdown2.Selected.LAB_x0020_NAME)
    )

     

    //UpdateContext({
    // varOwner:
    // varHatter.'LAB OWNER'.DisplayName}
    //);
    //Set(
    // varOwner,
    // Concat(colLABNAMES,ThisRecord.LAB_x0020_OWNER.DisplayName)
    //)
    //UpdateContext(
    // {varOwner:
    // Concat(colLABNAMES,ThisRecord.LAB_x0020_OWNER.DisplayName)}
    //)

     

    Really need some help on this issue, seems like I've been trying to resolve it for the better part of 2 days without the results I'm hoping for.

     

  • Verified answer
    PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @myka the Default property is the correct one. My fault.

     

    Ok. Let's have a look at your other issue. What is Dropdown2? What values are inside that Drop-down? Which datasource?

     

    Filter will alwayy return a table! Lookup will return a single record. If you want to access a single column returned by a lookup you just have to append a .ColumnName

     

    Lookup(.......).ColumnName

     

    But looking at your examples I believe Dropdown2 already has the value you are looking for.

     

    If not and the explanation above won't fix your issue please describe your app in more detail. Which Datasource you are using, the structure of your tables. Maybe provide some screenshots of the data so we get a better understanding.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    myka Profile Picture
    33 on at

    Ok, this finally worked:

     

    Ok, this finally worked. I set the OnSelect and OnChange value of my Dropdown2 to the following:

    Set(
    myRecord,
    LookUp(LAB_NAMES, LAB_x0020_NAME = Dropdown2.Selected.LAB_x0020_NAME)
    )

     

    That returns exactly 1 record. My previous queries return tables, which didn't work.

     

    Then for each of my TextInput fields, I set the Default property to myRecord.'LAB OWNER'.DisplayName, myRecord.'LAB Type', myRecord.'LAB POC'.DisplayName. With that I'm able populate the values of those TextInput fields.

     

    Next challenge, submitting the form values and updating the two person fields in my SharePoint list.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard