cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Sudden err but no dev changes made 'Types of the specified context variables are incompatible.....'

 

Spoiler
"The types of the specified context variables are incompatible with the types specified elsewhere"

Hi All - I suddenly cannot navigate to ANY form in ANY app where context variables are being passed. This has started to err on ALL of my apps!

 

NO exaggeration to say I cannot support live apps right now after having waded through tens of 'yellow error triangles' in one app for quite some time only to see them disappear without having made any changes! Said app is now working but the others have started to err as well.

 

I found a similar thread and posted a reply there but I feel this warrants an urgent resolution AND the cause unrelated so I started new thread here!

https://powerusers.microsoft.com/t5/PowerApps-Forum/service-desk-template-errors-in-filter/m-p/47345...

 

(session ID below)

 

Session ID: c29acddf-9a17-5584-23f6-92ace3b9e215

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff Hemanth
PowerApps Staff

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Hi,

Both with context variables(which are scoped to screens) and global variables, the definition merging algorithm is the same. If you have multiple definitions for the variable, we try to merge their data types(the merge succeedes only if the differing definitions are table or record type and have distinct types for distinct columns).

For example:

correct usage -

Definition1: UpdateContext({var:{column1:true, column2:45}})

Definition2: UpdateContext({var:{column3:"Name Field", column4:{x:true, y:3}}})

the end result will have the type of variable 'var' = :{column1:boolean, column2:number,column3:text, column4:{x:boolean, y:number}}

 

Erroneous usage -

Definition1: UpdateContext({var:{column1:true, column2:45}})

Definition2: UpdateContext({var:{column1:"Name Field}})

Here you have deined column1 as both a boolean and a text which cannot be auto resolved. This will result in error showing up on the definition as well as all the usages.

 

The same is true for Set function usage. You can go to View -> Variables(experimental) and see all the places you have defined the variables and confirm that the types you are passing are compatible.

 

Thanks,

_hemanth

 

View solution in original post

22 REPLIES 22
RuiBarbosa
Level: Powered On

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Same problem here. Yesterday with 2.0.663 version everything was ok, today, I open the APP and this problem appears in entire application.

theCatalyst
Level: Power Up

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

I have the same problem. I was working yesterday and everything was fine, but today I got errors all over my application as soon as I opened it.

BenAtDataImprov
Level: Powered On

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Hi

 

I have an app that was working fine until yesterday. Today when I open it it doesn't even show any screens on the left pane. It seems a new version - 2.0.672 - released this week, has a SERIOUS bug in it. I can still run the4 app from Powerapp web but cannot edit it.

 

Anyone else have this?

 

Ben

duffysp
Level: Powered On

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Also the same for me. It was working an hour ago and has now broken without any changes being made.

 

PowerApps Staff Hemanth
PowerApps Staff

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Hi,

Sorry to hear that you are facing this issue. In order to find the exact root cause of the issue, It would help tremendously if you caould share the rules where you are facing the issue i.e. what is the Navigate rule and what is the rule where you set the type of the context variable in the navigated screen.

My email is hekum@microsoft.com Can you please email me with the details to speed up the process ?

 

Anonymous
Not applicable

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Thanks Hemanth - just sent you a reply.

BenAtDataImprov
Level: Powered On

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Hi Hemanth, 

 

I've also sent an email reply, with the msapp file giving the problem, attached.

 

Thanks

Ben

mr-dang
Level 10

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

I have had this happen all the time. I know what it is--and it occurs when you are typing formulas. As you type formulas, PA redetermines the validation for a variable. See my post: 

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Disable-check-for-errors/idi-p/45075

 

So when you are in the middle of typing:

UpdateContext({variable: tr...})

PA will stall since it's now unsure if the variable takes boolean values or this broken text. Once you finish typing the formula, PA might be okay again. Other times, the yellow signs will remain. The fix I have found is to save the file and reopen it. As long as the variable is validated to take the same type of data in every instance, the app will open correctly without the yellow signs.

 

In addition to closing/reopening the app, it's a good idea to view the variables: where are they used and how are they defined. In one variable I had--I defined it with all the columns in one area and fewer columns in another one. It would work in 99% of situations, despite the different definitions. Then in editing a definition or adding another definition in another location, the yellow signs. It is just best to keep it all the same number of columns. To be exact, I consider a variable that is based on a record in a collection to be different than a variable that is based on an item from a gallery. The gallery item includes all of the controls with the data while the collection record is just data. Once I got everything redefined to be based on collections, I started having fewer of these situations.

 

The problem with UpdateContext() and Navigate(,,variable) is that the variables are scoped to one screen only, yet you need to define them in so many areas. A recent version of PA introduced the Set() function which makes a variable universally accessible on any screen.

 

As I was transitioning to change my old formulas that used UpdateContext to use Set() instead, I noticed that all instances of UpdateContext stopped working--which is okay. No error dialogues or yellow signs popped up saying they were incompatible--this is good for transitioning as you don't want to be slowed down. I recommend that you switch over to Set. View the variable wherever it is defined, including in Navigation formulas, and change it to Set instead. 

 

Note: This is anecdotal, but I find that when writing a formula for Set(), PowerApps doesn't stall in the middle of typing "true." 

 

Note2: I started editing certain variables outside of PowerApps and copy+pasting it back, but it defeats the purpose of using the formula bar in PA: you miss out on the color coding, spacing, referencing, and autocomplete. However, in this method, I can't break variables. https://powerusers.microsoft.com/t5/PowerApps-Ideas/Disable-check-for-errors/idi-p/45075

Microsoft Employee
@8bitclassroom
Anonymous
Not applicable

Re: Sudden err but no dev changes made 'Types of the specified context variables are incompatible...

Very interesting mr-dang ..

 

Although we can't get away from this being a bug (as most users with the issue have not changed any code) it does give an insight into how PowerApps manages variables. I can see that even if a gallery's .Items are assigned to a connection and the .Selected is loaded into a var - there could be problems if the var writes to or reads from the original connection's records. As you say perhaps because of some difference in system fields that we're not aware of.

 

Also I suggested to Hemanth (@ Microsoft PowerApps) that it may be the new Set global var function that's now interfering with Context Variables?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,165)