Hi all,
Some advice is required on how to scope a session variable properly. I'm observing that my session variable is being scoped per Dataminer Cube session when the desired outcome is to scope it per Visio file.
At the page level, I'm using:
InitVar ---> ElementName:Element_A
I have several Visio files that does the same thing:
e.g.:
Visio file A
InitVar ---> ElementName:Element_A
Visio file B
InitVar ---> ElementName:Element_B
Visio file C
InitVar ---> ElementName:Element_C
However, the end result is that I see the following when I load Visio file A first:
Visio file A
ElementName:Element_A
Visio file B
ElementName:Element_A
Visio file C
ElementName:Element_A
Hi Bing,
The answer of Ive can apply to both page and shapes, but I would recommend to use it typically on Shapes. For page level - or initialization - I would suggest you to use the following: Configuring a page to update a session variable when another session variable changes | DataMiner Docs.
Important here is that you make sure to use the option 'ExecuteSetsOnInit' as well.
Kind Regards,
Jarno
Hi Jarno. Thanks for the post. I did experiment with this approach and found that it is working most consistently for the use case I'm working on.
Hi Bing,
Session variables can have one of the following scopes:
- Current DataMiner Cube session (default scope)
- Current DataMiner Cube card
- Current Visio page
- Current workspace
To change the scope, an additional shape data field of type Options must be added to the shape.
More info can be found here:
Hi Ive, what was confusing to me was how to scope InitVar. Does scoping not apply for InitVar?
It does, but in that case you need to place the Options shape data on the page. It might be that your variable gets initialized in all 4 scopes at once though, but that should not be a problem for your use case as you can still update and use the var within a specific scope.
Hi Toon, the problem is that I'm using the same variable name across multiple visuals (multiple services) and need the variable to be only set at the page (at the very most card) level.
As long as you use the page or card variable scope where you are making actual use of the variable, that should not be a problem, as those will be unique to that scope.
I stumbled upon this post which answered my question: https://community.dataminer.services/question/visio-page-inititvar-behavior.
However, I'm open to hear any other ideas.