Sorry for the delay Hemanth,
At the moment I have an issue with two variables that are being passed in a Navigate function.
here is the function:
varJobID is passed to this screen from a previous screen (passed in the navigate function). (EG Data: 008805)
varJobCardID is passed to this screen from a previous screen (passed in the navigate function). (EG Data: JC001)
varDate is passed to this screen from a previous screen (passed in the navigate function). (EG Data: 28/07/2017 - Formatted as text)
lblTracksheetID is just a label field with data like "123456".
I changed the names of the variables being passed in case this was causing the issue (as they are the same names as the source variables) but this makes no difference EG:
These were both working fine yesterday afternoon but when i had came back from lunch my PowerApps application had been updated and this started happening.
Removing those two variables from that function causes it to work ok.
The other two variables JobID and JobCardID work fine.
@duffysp, can you confirm if varDate alias is defined and its type can be inferred when varDate is assigned to varDate. this error might be due to assigning varDate to varDate and it's type cannot be derived.
Thank you for providing the details. we will inveatigate the issue on our end with the example you have provided. Meanwhile, can you try a workaround and check whether it fixes your issue.
We have global variables and you use 'Set()' function to set those variables. https://powerapps.microsoft.com/en-us/tutorials/function-set/
As the scope of those variables is global, you don't have to pass it accross screens to use it. you can use it anywhere by setting it anywhere. I think this should unblock you.
I posted a new idea that I think can resolve this issue:
If you can write an original definition of a variable, perhaps it can avoid instances in PA where variables seem to conflict since the original definition would take priority.
Please upvote the idea if you agree.
@Hemanth, can you share more about how PA manages definitions of variables--which one takes precedence?
Well ... I tried using Set() - replaced all definitions (like-for-like for now, with a view to eventually using only one definition on first requirement) and uses (of which there were MANY) with new syntax.
It worked initially, closed, reopened, now the SAME error caused by SET.
This is only ONE of many of my apps - can this be escalated to v.urgent or something:)
I was passing a fair few local variables from screen to screen. I removed these and set them as global variables which took a while (pretty much a re-write) but probably saved me many headaches in the long run. I still have local vars but these are limited to each screen; very few vars are passed between screens now.
This resolved the issue for me. I did get the same error a few times but it was because the data type being assigned was incorrect. Encapsulating it in a Text() or Value() fixed this for me.
Whether this was the case all along and switching to global vars just made it easier to find them I don't know.
@Anonymous How many of your variables are giving you this error? All or just some of them?
I found it easier go through the whole app for a single variable and find everywhere it was being set and what the data looked like at that point.
If you are comfortable sending on your app I'll be happy to take a look. It obviously won't hook up to a datasource but can try and help find if there are any weird assignments.
Thanks duffysp; I'll go the extra step and remove any unnecessary definitions. I have 2 variables causing the error and stepped through all known uses of each one (disclaimer - I used the Experimiental variables section which missed a few uses as the scrollbar froze !) ... logic tells me there must be an error somewhere as my other Set vars are OK (or perhaps until I fix the 2 offenders then the floodgates will open!).
All I can assume right now is a possible difference between all columns in a Gallery.Selected record and the actual SharePoint connection's record which loaded it (same var is loaded with either at some point).
As I mentioned at my first post - this all worked before!
Thanks again for the offer of assistance - I may need your help soon enough ...
Hey Michael - it turns out one of the 2 new (error state) Set() vars was declared twice as a result of the like-for-like change from context vars. I removed one declaration (after careful consideration of precedence!) and the error cleared for this and the other var (which at some point consumes data from the first).
'Kind of' happy now but the way I understand this is;
a/ 2 declarations should not have been a problem
b/ the error message may be misleading & way too generic
c/ I'm not 100% sure that my fix will be everyone's fix as it appears to be due to
... sorry, to continue my last post ...
it may be due to any of,
1/ Multiple declarations (as in my case in part)
2/ Misuse of variables (as per the error message)
3/ Passing record-type context vars in navigate statements (I think everyone's issue in part - for those who have errors)
Thanks again Michael, all
Glad to hear you got it sorted.You are correct though; I would hope that multiple definitions wouldn't cause an issue but we're a bit in the dark as to how Powerapps handles the same variable being set more than once with different datatypes.
If @Hemanth is able to answer @mr-dang's question about how Powerapps decides which definition is wrong / which one takes precidence or if we were able to specify the datatype that the variable should be, it might allow for easier fault finding.
Thanks for the help all.
Find your favorite faces from the community presenting at the Power Platform Community Conference!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
Features releasing from October 2020 through March 2021