AnsweredAssumed Answered

Grab value from a dynamically named variable.

Question asked by schpa on Apr 20, 2015
Latest reply on Apr 20, 2015 by schpa

Title

Grab value from a dynamically named variable.

Post

So I've been using a script from a source I can't seem to find again, but basically, it's an OnLayoutLoad script that gathers the visited layouts in a $$Stack variable and the currently viewed layout from this stack in a $$Number variable used to navigate back and forth between layouts just like in a web browser, a very handy little function.


Now, the problem with it is that it's stored globally in the whole file, so if I were to open up a new window and visit other layouts in that window, this would add to this stack and the navigation would be between the layouts visited in the former layout aswell. For me, this is a bit chaotic and confusing for the consumer, and I would therefore like to make a seperate $$Stack and $$Number variable to each window. The way I've done this is be using the custom function fnSetGlobalVar to store the calculations in a dynamic variable $$Stack & Get ( WIndowName ). However, the problem is that the calculations also requires the value from the $$Stack and it doesn't work to just grab the data from  ( $$Stack & Get ( WindowName ) ) as that just leaves me with the value in the $$Stack variable and the window name, which just messes the whole script up and does not work.

To solve this, I've been trying to grab the data from, if the window name is say "Customers", with a local variable $stack with the value: $$Stack & Get ( WindowName ), but that just leaves me with the exact same thing, the value of the $$Stack and then the name of the window, in other words, it's useless in my case.

Now, my question is; how do I go about acquiring the data from the dynamically named variable without having to do an if or case evalution for each and every window name? Is it even possible?

To make it clearer, if the Get ( WindowName) = "Customers" I want to calculate with/get the values from the global variable $$StackCustomers and $$NumberCustomers with a variant of 

Set Variable [$Stack; Value; $$Stack & Get ( WindowName )]
and the equivalent for $Number

that actually leaves me with $$StackCustomers and not the data in $$Stack and then the window name, so to speak, hehe.

I've been searching for a way to do this for hours but couldn't find a reasonable solution so I beg the experts of this forum for some very needed help :)

Hope this wasn't too confusing and thanks for your attention.

Simen

Outcomes