Global Variables Reset On Page Load


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?


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.



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. :slight_smile: )

Maybe this experience would be of help to someone.


THX. That was the fix.


I did exactly the same stupid me, and could not figure out why that happens.
That’s why I love this forum!

Keep sharing!:hugs:


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


Just regenerate with the comand Ctrl+O. :slight_smile:


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 so much! you nailed it!


Thanks @Noga , that was the fix.


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.