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?

Anonymous
Not applicable

@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.

Anonymous
Not applicable

@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

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

  It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd. at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3rd, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!       Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪🌠

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

March User Group Update: New Groups and Upcoming Events!

  Welcome to this month’s celebration of our Community User Groups and exciting User Group events. We’re thrilled to introduce some brand-new user groups that have recently joined our vibrant community. Plus, we’ve got a lineup of engaging events you won’t want to miss. Let’s jump right in: New User Groups   Sacramento Power Platform GroupANZ Power Platform COE User GroupPower Platform MongoliaPower Platform User Group OmanPower Platform User Group Delta StateMid Michigan Power Platform Upcoming Events  DUG4MFG - Quarterly Meetup - Microsoft Demand PlanningDate: 19 Mar 2024 | 10:30 AM to 12:30 PM Central America Standard TimeDescription: Dive into the world of manufacturing with a focus on Demand Planning. Learn from industry experts and share your insights. Dynamics User Group HoustonDate: 07 Mar 2024 | 11:00 AM to 01:00 PM Central America Standard TimeDescription: Houston, get ready for an immersive session on Dynamics 365 and the Power Platform. Connect with fellow professionals and expand your knowledge. Reading Dynamics 365 & Power Platform User Group (Q1)Date: 05 Mar 2024 | 06:00 PM to 09:00 PM GMT Standard TimeDescription: Join our virtual meetup for insightful discussions, demos, and community updates. Let’s kick off Q1 with a bang! Leaders, Create Your Events!    Leaders of existing User Groups, don’t forget to create your events within the Community platform. By doing so, you’ll enable us to share them in future posts and newsletters. Let’s spread the word and make these gatherings even more impactful! Stay tuned for more updates, inspiring stories, and collaborative opportunities from and for our Community User Groups.   P.S. Have an event or success story to share? Reach out to us – we’d love to feature you!

Top Solution Authors
Top Kudoed Authors
Users online (7,571)