cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aaa2813
New Member

Error with SharePoint List context variable

I've seen a few threads discussing errors with context variables, but none of those solutions seemed to work for me.

 

I'm building an app that has connections to different SharePoint lists. There are different buttons that navigate to a calendar screen to display the SharePoint list data. So for example, there are 3 buttons that use the same Navigate() function, but with different context variables:

 

Navigate(
    CalendarScreen,
    ScreenTransition.Fade,
    {
        DataTable : Table1, // this is a SharePoint List
        String1 : "Sample String 1",
        String2 : "Sample String 2"
    }
)

 

 

So the DataTable variable in each button will be "Table1", "Table2", "Table3", etc. I can enter this function for 1-2 buttons with no problem (the calendar screen works properly), but upon entering this function for the 3rd button, all of the buttons produce 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."

 

I've checked the View > Variables menu to ensure that the DataTable variable didn't have any other definitions, but it's only set to SharePoint Lists, which show up as type "Table". On the other hand, the string variables can support multiple definitions with no problem, which leads me to believe that this is an issue with the SharePoint List connections only. I also tried setting the DataTable variable to be a global variable, but I had the same issue after 2-3 buttons were set.

 

Does anyone have any idea about what could be causing this issue, or if there's a workaround I could use?

1 ACCEPTED SOLUTION

Accepted Solutions

@aaa2813 

Yes, it's quite dangerous in PowerApps to try and switch datasources like that on a control.

If the datasources have the EXACT same signature, then you have some success, but the second one changes, the app falls down.

 

Consider the following concept.  Since your datasource is global, all you really need to pass would be the reference to the datasource.  Like this formula:

Navigate(
    CalendarScreen,
    ScreenTransition.Fade,
    {
        DataTable : "Table1", // this is a SharePoint List NAME
        String1 : "Sample String 1",
        String2 : "Sample String 2"
    }
)

 

Then in the Calendar screen, depending on where you are/were basing off of the original DataTable as a datasource, put a formula like this in place:

Switch(DataTable,
    "Table1", Table1,
    "Table2", Table2,
    ...etc...
)

 

NOW...you still might get in trouble if there is dissimilarity between the Table1, Table2, and so forth, datasources.  But if not, this should get you what you want.

If you DO have dissimilarity between them, all is not lost, you can use them to "create" a default signature - but there is more work involved in that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@aaa2813 

You can only assign multiple datasources to a variable if they have the EXACT record signature.  

I am not entirely sure why you would want to pass these around or assign as global...they are already global to your app.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes Thanks for the clarification about assigning datasources, I wasn't aware of that.

Sorry if I wasn't clear in my original post: I'm trying to get a calendar screen to display different data depending on which button the user clicked & navigated from, somewhat replicating the behavior of the default new calendar screen in PowerApps. I don't know if this is possible without passing datasources as variables.

@aaa2813 

Yes, it's quite dangerous in PowerApps to try and switch datasources like that on a control.

If the datasources have the EXACT same signature, then you have some success, but the second one changes, the app falls down.

 

Consider the following concept.  Since your datasource is global, all you really need to pass would be the reference to the datasource.  Like this formula:

Navigate(
    CalendarScreen,
    ScreenTransition.Fade,
    {
        DataTable : "Table1", // this is a SharePoint List NAME
        String1 : "Sample String 1",
        String2 : "Sample String 2"
    }
)

 

Then in the Calendar screen, depending on where you are/were basing off of the original DataTable as a datasource, put a formula like this in place:

Switch(DataTable,
    "Table1", Table1,
    "Table2", Table2,
    ...etc...
)

 

NOW...you still might get in trouble if there is dissimilarity between the Table1, Table2, and so forth, datasources.  But if not, this should get you what you want.

If you DO have dissimilarity between them, all is not lost, you can use them to "create" a default signature - but there is more work involved in that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@RandyHayes This is a really interesting alternative, I'll try it out! Thanks for your help!

@aaa2813 

Yes, it's kind of the PowerApps way.  The prior was more of a developer way...PowerApps is not development!  In PowerApps, you really do more reference and formulas to arrive at your results rather than assigning or passing.

Happy to help!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,089)