web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error Variable set (in...
Power Apps
Answered

Error Variable set (incompatible with the types of values in other places in your app)

(2) ShareShare
ReportReport
Posted on by 566
Hi,
 
When i'm trying to set a variable on multiple screens i get this error 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.
 
Here is the Variable i use; 
Set(PDD1;TextInput4_42.Text)
and the other variables set also to "PDD1"
 
Set(PDD1; If(CountRows(colNCOLIS) >= 1; First(colNCOLIS).Weight; Blank()))
Set(PDD1; If(CountRows(colNCOLIS) >= 1; First(colNCOLIS).Weight; Blank()))
One of these variables is located on OnTimerEnd of a timer control  and the two others a select of a button control.
 
What does this error means? and how to avoid this kind of error next time?
 
This variable is used to show weight values on a label control.
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    What type of field is Weight ? If it is a number, then the first one should be
    Set(
       PDD1;
       Value(TextInput4_42.Text)
    )
    The second should work, but this may be better
    Set(
       PDD1; 
       If(
          CountRows(colNCOLIS) >= 1; 
          First(colNCOLIS).Weight; 
          0
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Suggested answer
    StretchFredrik Profile Picture
    3,397 Super User 2025 Season 2 on at
    Hello,
     
    The error means that you for example first set your variable to a text value, and in another place, you set it as a number value. This is not allowed. A variable must be the same type everywhere in your app. So in your case, if you do for example:
     
    Set(PDD1;Value(TextInput4_42.Text))
     
    it should work. Because then the variable is always a number.
     
    If my response solved your issue, please mark it as ✅ Accepted Answer and give it a like.
  • Sormick Profile Picture
    566 on at
    This value is a number with two decimals get from a sharepoint list with the creation of a collection:
     
    ClearCollect(
        colNCOLIS;
        FirstN(
            ShowColumns(
                Filter(
                    CP78RECTIFCP87;
                    Dispatch = Label11.Text && OBSERVATIONS = "MISSING"
                );
                'Item ID';
                Weight;
                'Destination Country'
            );
            10
        )
    )
     
    and set this variable to get the weight value of my collection colNCOLIS
     
    Set(PDD1; If(CountRows(colNCOLIS) >= 1; First(colNCOLIS).Weight; Blank()))
     
     
    This weight must be shown on a Label on a form.
     
    Now i'm trying this function to get the new weight for my new textinputbox:
     
    Set(
        PDD1;
        Substitute(
            Text(
                Value(TextInput4_42.Text);
                "[$-fr-FR]0.00"
            );
            ".";
            ","
        )
    )
    But i still get the same error:
     
    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.
  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    OK - the issue is the opposite - if the Weight field in colINCOLIS is Text then you also need to ensure that the output of TextInput4_42 is rendered to Text, so
    Set(
       PDD1;
       Substitute(
          Text(
             Value(TextInput4_42.Text);
             "[$-fr-FR]0.00"
          );
          ".";
          ","
       )
    )
    and then your original code
    Set(
       PDD1; 
       If(
          CountRows(colNCOLIS) >= 1; 
          First(colNCOLIS).Weight; 
          Blank()
       )
    )
    The issue here is that a Variable needs to be set to the same data type everywhere you set it, so in the case, it would be Text.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Sormick Profile Picture
    566 on at
    Thanks to you i don't have this erreor anymore!
     
    Thousand of thanks to all community!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard