Message Boards Message Boards

Back

Variable for page just left

Variable for page just left
Answer
8/1/18 12:01 AM
Is there a way to set a global variable for the page that you've just left. The problem I have is that the sequence of pages in my program is sometimes linear but sometimes non-linear. The back button in my Masters is set to take you to the previous page which is the previous page in the linear sequence. Sometimes this is appropriate, sometimes it isn't. I'm looking for a method that sets the global variable to the page name of the page as you leave it and then the back button is programed to get that global variable to take you back to that page.
I've tried when page 'on change' set variable to page name but it doesn't work and I suspect I'm setting to variable to the page I've just arrived at?
Any suggestions, thanks
0 (0 Votes)

RE: Variable for page just left
Answer
8/1/18 12:16 AM as a reply to Nick Evans.
Hi Nick,
The problem you describe sounds accurate - if you use Page.onChange, it will get the current page. 

To do this, you could set up 2 variables, and on page change, store the current page in one variable (current_page_var), and then on the next page, shuffle that value from current_page_var to the other variable (last_page_var). 

However, that will only work to go back 1 page.  Here's another method that is a little more involved, but allows you to go backwards all the way to the beginning of the lesson - http://share.smartbuilder.com/public/support/backbutton.mp4

Hope that helps!

- Nav
0 (0 Votes)

RE: Variable for page just left
Answer
8/1/18 2:24 AM as a reply to Navdeep Dhillon.
Thanks Nav, that's just what I need and a really clear explanation video. I'd encourage other 'greener' Smartbuilders (like me) to work through this video. It's a great excercise for understanding variables and lists. I was beginning to understand the former but hadn't really understood the functionality of the latter.

Thanks again for your great support, Nick
+1 (1 Vote)