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

Bug with global variable

Hi everyone,

 

I just posted this bug report in Sudden err but no dev changes made 'Types of the specified context variables are incompatible.....' and I don't know why it got rejected. Maybe it was because the thread was old? So I'll open a new one. If something is wrong with this post, please tell me what it is.

 

 

 

All of a sudden, I experienced a bug with global variables. Context Variables are not (yet) effected.

 

The functions where I used a global variable don't work anymore. Error messages state either: "Function 'xy' has invalid arguments/parameters." or: "invalid argument type" or: "The types of the specified context variables are incompatible with the types specified elsewhere".

 

The last error message (types incompatible) only appears within the Set() functions. After I removed all but one Set functions (I had only three), this error disappeared at the remaining Set function. But even then every other error stays.

 

Via the PA web interface, I restored an older version of my app from 2 weeks ago. I know for sure, that everything was working just fine there and no error appeared when I built this old version. Also until today everything worked fine. But since today with the current version as well as with the old version the global variable doesn't work anymore.

 

Even more strange: Everyone still can use the app without errors. Also the forms etc. affected by the errors work just fine. The errors only appear within the development mode (and preview mode). I still can use the app normally on my Android Smartphone. It also works just fine at my own Windows 10 PC and at the PC of one of my colleagues. The currently published version was made between the 2 weeks old one and the current one. And I also tested to restore this version, of course, but the same errors appeared.

I even changed the Live version today, before the errors came up. Also the last Live version before that worked normal.

 

 

I use this global variable to bind one of several data sources (Excel tables) to different forms at runtime. So the users can chose between different news channels to read or write news. To chose between different data sources I included a dropdown menu with the following relevant functions:

OnChange: 

Switch(
    Dropdown2.Selected.Value;
    "A-News"; Set(SelectedNewsSource; News_A);
    "B News"; Set(SelectedNewsSource; News_B);
    Set(SelectedNewsSource; News_A)
);;

Items:  

["A-News"; "B News"]

"News_A" and "News_B" are the data sources (Excel tables on OneDrive for Business).

 

 

Every form and element which refers to this data instead refers to the global Variable SelectedNewsSource (at least indirectly via a reference to the corresponding BrowseGallery).

 

 

I believe there must be a bug in PA, as the errors now come up even in older versions. The PowerApps Release / Version didn't change over the last three weeks. Based on the version overview for my App the PA version is 2.0.730.

 

It would be really nice if one could solve the problem. If you need more information I'll try to provide them.

 

Best Regards,

Roberto

10 REPLIES 10
Anonymous
Not applicable

Hi, @Anonymous.

 

I did get a notification about your apparently-rejected post and thought it was weird. In any case, I'm not sure if the same bug is causing the problem but I'll put in my thoughts about it.

 

Regarding this error:

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

That message is symptomatic of the main update that happened in PA, the one discussed in the thread before. It was a change from having PA being weakly typed to PA being strongly typed.

 

This means that having these two statements

Set( x, "This is a string" );
Set( x, 5 )

is invalid now since the first statement assigns x a string and the second statement assigns x a number. Basically, whatever type of the value you set first to a global var, it must stay that way.

 

Do note that the Set() function, AFAIK, does not add extra columns to the table structure that's set to it on its first assignment, unlike ClearCollect() and Collect(). So, if your two data sources, News_A and News_B, differ in structure (i.e. their columns are different), they're considered two different data types. I might be wrong in this one. The PA dev team might have changed it. They put up so many silent updates/fixes, it's annoying.

 

Are you sure that your global variables are consistently assigned the same type of data? If yes, then it's probably another bug. If not, fix that first and go from there.

 

Also -- about this:

    Even more strange: Everyone still can use the app without errors. 

I had a similar experience about that. What caused mine was that there was a difference on what version of PA is loaded on View mode and on Edit Mode. Notice the PowerApps Version Release column on your save/version history? That only applies on View Mode. Basically, Edit Mode always loads the latest version of PA, meaning it always uses the latest version of rules.

 

Is the PowerApps Version Release value of the version of your app that's working on View but not on Edit the same as the latest release of PowerApps? If so, then the new rules added/changed by the update most likely caused the bug. If not, that's really weird and I can't help you with that because I don't know what happened.

 

Then again -- PA had switched to being strongly typed only around Summer 2017. This might be an entire new bug.

Anonymous
Not applicable

Thanks for your reply, LoneWoof. I checked the hints you gave me.

 

Regarding this error: "The types of the specified context variables are incompatible with the types specified elsewhere".

So, if your two data sources, News_A and News_B, differ in structure (i.e. their columns are different),

 

I put a bit hope in this hint but I cannot find any structural differences between both files. Both use the exact same columns. (Originally they are copies of each other and after that there should have been only content updates - new lines in the table.)

 

 

Are you sure that your global variables are consistently assigned the same type of data? If yes, then it's probably another bug. If not, fix that first and go from there.

 

I used the View > Variables(experimental) function to double check if I forgot any definitions.

 

I have three definitions (using Set function). They all work the same.

I allready tried to delete all but one Set functions. The other errors other than "The types of the specified context variables are incompatible with the types specified elsewhere" remain. So it still cannot load the data and displays errors like: "invalid argument type".

 

Basically two of the three set functions are just used to make sure, the data sources are fetched as early as possible and to really make sure that the variable is initiated before first use - befor the user opens the corresponding screen (which still doesn't work as the gallery screen still needs a manual change in the dropdown menu befor it displays any content - but thats a different problem):

If(
    IsBlank(SelectedNewsSource);
    Set(SelectedNewsSource; News_A);
    []
);;

The main definition is the one I posted in the first post - with the switch function for the dropdown menu.

 

 

 

Is the PowerApps Version Release value of the version of your app that's working on View but not on Edit the same as the latest release of PowerApps? If so, then the new rules added/changed by the update most likely caused the bug.

 

The web version overview states that all app versions from the last 4 weeks are build on PA release 2.0.730. Also the version I build/saved today - while the current PA version should be newer.

 

I don't know how to get the version information of PA Studio. But as my colleague and I have installed PA Studio from the Microsoft Store on Windows 10, I assume that we have the current version (2.0.733?).

According to the analyse (preview) site on the PA web interface the app is currently (today) used on player version 2.0.730 and on 2.0.733.

2.0.730 has only one active user so it's probably not me and my colleague.

 

Maybe some differences between 2.0.730 (app version) and 2.0.733 (assumed PA Studio version) could be the reason for this bug.

 

 

Then again -- PA had switched to being strongly typed only around Summer 2017. This might be an entire new bug.

 

Yes, I think you are right and it's a new bug.

Or I made a mistake, I didn't realize. But I really don't know what it could be then. Because at least then it must be something minor which wasn't a problem until last week.

Anonymous
Not applicable

I'm tagging @Hemanth. He posted a solution/explanation of the original error ("...are incompatible...") popped up a few months ago. He might be able to better explain what's happening.

 

I'm sorry I can't help you with this problem. Hope it works out for you.

Anonymous
Not applicable

Wow... I found a solution myself + highlighted another error and took over an hour to compose the report (even if it's not so rich of technical informations)... and it took someone about 5 minutes to reject it... again. And why is there no link in the profile/settings to at least view my own rejected posts. I first have to go back in browser history - edit/save the post again to get this link just to make sure it got rejected. What a crap.

 

Well, I'll post it again, maybe it stays this time and maybe it either helps customers or PA developers. But after that I'm gone. I read and post in many different web communities, but never expirienced such a user hostil behaviour.

 

----

 


Regarding this error: "The types of the specified context variables are incompatible with the types specified elsewhere".

So, if your two data sources, News_A and News_B, differ in structure (i.e. their columns are different),

 

 

Are you sure that your global variables are consistently assigned the same type of data? If yes, then it's probably another bug. If not, fix that first and go from there. 

 

I tested this aspect again and found a solution. But I'm still searching the error.

 

I replaced News_B with a copy of News_A (and also reopend my app and deleted + newly imported the fake News_B as a data source). Everything worked fine now, so the global variable itself cannot be the root of the problem.

 

Then (with some other knowlege from another error I just fixed) I again took the original News_B and replaced or deleted evere date & time data in there with date/time date I took from the respectiv columns of News_A. This also fixed the error.

 

Spoiler
The data comes from an by PA automatically generated and manually edited editForm. The DataCard includes a date picer and two dropdown menus to select the time (PA's default layout in such a case). The update function which creats the data that should be stored is:
DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value); Value(MinuteValue2.Selected.Value); 0)

 

=> So it actually was a problem with a "structural" difference in both data sources that should be assigned to the variable. This time it just wasn't about columns but about data format within the Excel table.

 

I still don't know why this error emerged just now after it worked befor.

 

In News_A I had combined date/time colums with the format (within excel): date (dd.mm.yyyy). (German format, in case anyone wonders).

The newer lines/data sets were formated as user defined (dd.mm.yyyy hh:mm).

This difference obviously is no problem for PA.

 

But News_B maybe was empty when I included it in PA. So maybe the colums weren't formated correctly.

But even in case it was empty at the beginning, I remember that I looked into the data at some point and I remember the formats. So I don't know exactly when or why it happend, but I think at some point PA changed the format of data that was allready stored there by PA earlier.

  

In the first lines:

The date colums in News_B are either formated as date (dd.mm.yyyy hh:mm) or as default (which in this case was a number like 43077). I am quite sure, that the cells with default format were at some point formated or at least displayed as date. Even if I select them now, Excel's function field at the top doesn't show a date, just the number.

 

In newer lines:

Every date column in News_B is formated as default (with numbers like 43525,20833).

 

=> So at least: PA first decided to switch the format at some point in the middle of the tables AND obviously LATER decided that this isn't compatible to the News_A format, which resulted in the error I had.

But this could be my fault as I maybe didn't defined the formats correctly at somepoint.

 

==> That leads me to the question: Can somebody point me at e.g. some tutorials that explain how to define formats if one uses Excel as data source?

 

 

To show you the complete picture I now have to talk about another error. 

In short: I log some activities of the app users in an excel file with the following OnSelect unction:

Navigate(...; ...);;
Collect(UsageStats;{user: User().Email; username: User().FullName; screen: "XY"; function: "News"; notes: ""; date: Now()})

The resulting table again has a date+time column called "date", formated userdefined (DD.MM.YYYY hh:mm). I often looked in this table so I'm really sure whats goining on in there. Until the end of last week everything looked like everyone would expect.

 

Today I (and every other user) got a error message when opening the app (translated freely):

Error while loading "UsageStats". Answer of server: The requested process is invalid. Error while reading the content of a cell. Reason: Not a legal OleAut date. clientRequestId: ...

 

When I opened the UsageStats table in Excel I saw that something happend with every date/time-stamp in there from the beginning until today morning. For every timestamp only many "#" were displayed - even after I expandend the width of the column to the max. of 1789 pixel.

 

After I deleted the corrupt timestamps the error message at start was gone.

 

=> Above for the original error I wasn't sure if PA changed some already saved, older data (formats). This time I am sure, that PA not only changed data (which shouldn't be changed by PA no matter what as I didn't anywhere used a function to change existing data) but it also corrupted the data in a way that PA itself couldn't handle it anymore.

 

==> All in all:

  • There must be at least one bug. Because data which should not be changed by PA anymore was corrupted by PA.
  • Different date formats in two data sources make them type incompatible.
  • PA also switched at some point between different date types itself, which resulted in all the errors in my news screens.
  • There wasn't any problem with the global variable itself.
  • I think there could be another bug as PA had no problems with the data sources 4 days ago and then decided to display errors. Even more surprising the errors only occured in Edit/Preview mode, while normal users could interact with the screens and edit the faulty datasource via the PA app. This "bug"(?) could be based on a different data source handling of PA release 2.0.730 and 7.0.733.
Anonymous
Not applicable

Good for you! PA can get nitpicky at times.

 

Although, I don't know if there exists some documentation regarding defining data types in Excel. As you may have noticed, there is a severe lack of good documentation for PA.

 

And if this is actually a bug -- I'm tagging @v-micsh-msft and @v-monli-msft so they can see this.

 

Hope you the best of luck, man.

 

P.S. I've never experienced getting my posts rejected before. I wasn't even aware there was a mechanism for it. However, I do agree that the UX for this community isn't the best. It isn't that good either.

not sure if this is related but I am experiecing issues with declaring, and setting values for, both global and context variables when used in the 'OnVisible' field for a screen, e.g..

 

UpdateContext({varCurrentYear: "2017"});
UpdateContext({varCurrentMonth: "September"});

 

When the screen loads (is made viisble to user) the variable is declared but the values are not applied.....what am I missing here?

@Justin_Reading --

The OnVisible property can be a bit tricky. If you're in Edit Mode, sometimes, the event only gets triggered when you Navigate() to a screen during Preview (not when you open the Preview) or move to it via the screen pane outside of Preview

@Anonymous

Thanks for the suggestions. I have already tried all these as well as publishing the app and testing again but still no luck.

 

Then I went back and checked my code.....wouldn't you know it there was one stray semi-colon in an UpdateContext function further down, but Power Apps didn't display an error.....sigh.

@Justin_Reading --

Oh, god. That happened to me so many times too. Lol. But technically, PA does let you know about the stray semicolon at the end -- with an itty bitty red jagged line under that stray semicolon. (If only the devs were to use their own tools, sigh.)

 

Thanks for making me laugh, dude. 😄

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (982)