When I set a global variable upon navigation away from a page, I can tell that it works and is being set; however, when the next page loads, the variable is reset to unknown. This is for a team project. Any ideas on what is going on?
Global Variables Reset On Page Load
Try setting the global var = 0 or any initial value. Reset it back to that value once the page load trigger happens. This will fix your issue. A link to your prototype can help in giving you a better response.
If I understand what youāre trying to do, it appears to work fine. I have attached a sample RP file that does what you say.
GlobalVariableNavTest.rp (81.4 KB)
But I am setting the value from an interaction ā¦ but when i go to another page where i want tuse the newly set value the variable has reset and thats where the problem lies.
Hi!
Navigating from one page to the other will not reset global variables unless you are specifying the go-to page by using a URL rather than selecting it from the list of pages in the Open Link in Current Window command. Global variables will not carry over to the new page if you navigate to it using a URL.
If thatās not the case, in the prototypeās left-hand site map (within the browser) there is a ā(x) consoleā tab. If you click that it will show you the values of your global variables. Use that to verify that the global variable sticks around upon navigation.
If the variable value changes upon page navigation, there is likely some code that is changing it. Also in the ā(x) Consoleā tab is a ātraceā of all executed commands. Hit Ctrl+S in your browser and search for āset value of variableNameā (where variableName is the name of your variable) to see if some code somewhere is setting it.
If @josephxbrick hasnāt solved your problem, you might want to upload a sample .rp file for us to look at.
I had the same issue and managed to solve it.
The problem occurs if you first open a page (Open Link in Current Window) and then set the variable. In the ā(x) consoleā you see the variable value change momentarily to what you had set, and then it immediately changes back (using Chrome browser).
Switching the order, i.e. first setting the value and then opening the page, fixed the problem.
I had a problem with a self-reseting variable. It behaved strange.
Now I understand why.
The problem was I was regenerating single page only. After I generated the whole project, issue was resolved.
(They are named global variables with a reason. )
Maybe this experience would be of help to someone.
I did exactly the same stupid me, and could not figure out why that happens.
Thatās why I love this forum!
Keep sharing!
Hi! I am having the same issue and I canāt understand the āsolutionā you mentioned here.
Could you give me more details?
thank you
Rachel
This solved the problem for meānot navigating by URL, but rather direct page reference.
I have the same issue, but I donāt want to load the page from a direct page reference. Iām loading my pages through their name on the navigation which is an item in a repeater (my menu). Unless anybody knows another way to open a page by variable nameā¦ At the end I will have to remove the repeater.
Thank you for this thread! I having a heck of a time figuring out why Axure was resetting my global variable.
For me, I was setting the global variable in a common form I could access from multiple pages, then using the OpenLink interaction with the target āBackā to return to the page it was called from.
This was handy to quickly remember the page the common form was accessed fromā¦ but because I now realize it resets global variables set in said formā¦ Iāll need to figure out a new way to do this.