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

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

@Anonymous 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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

@Anonymous 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

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

@Anonymous 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

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

@Anonymous 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,540)