I need to access session custom variable values within a Tag Value Changed script. Is there a way to retrieve all the session custom variables from this script context?
Any suggestions or best practices would be greatly appreciated!
At the start of the session, we create several custom variables with predefined values. Later, we use these variables to update different tag values as needed.
For example, if the value of Tag A changes from 10 to 5, we want to update Tag B using the value of a session custom variable (e.g., V1).
I hope this clarifies why we need to access session variables in this context.
A global variable in Ignition is a Memory Tag, don’t use these as session variables.
Make a memory tag and set your tag change script to change the value using writeBlocking().
This is possible, but a bit dangerous as users are not guaranteed to have the same session parameter value. If you never change these and its the same for every user its probably. safe enough, but there is almost certainly a better way to go about it.
Writting to a memory tag like @David_Stone stated, should work.
No. That's is why you are being directed to use other techniques.
In Ignition, the type of variable that is persistent and is common to all users is the memory tag.
If you needed something that was per-user, and also needed to react to tag changes, you would bind the tag into a session custom property, and write a property change script there (not on the tag).