How to define local variables independent of other users - Web Visualization

Hello everyone

I’m trying to do some animations in WebVisu, like visibility of objects, change colors etc.

But variables are all global, if i hit a button that turns the visibility of a object on, it turns on in every user connected in the same webpage. I tried to define vars inside the screen but it still change it’s values in all instances of connected users.

I want to now if there is a way to create a variable that runs local and don’t share the same memory globaly, just local for each user

Or if I can do a ST code or something that access the objects properties directly and change them without needing to put a variable, just change the property via script (ST) or something like that. I’m a bit familiar to do this things in other SCADA softwares but here i don’t see a natural way of doing it.

Thanks in advance

1 Like

Declare the global variable as an array
[VISU_MIN_NUMBER_OF_CLIENTS… VISU_MAX_NUMBER_OF_CLIENTS ] of your type/var/…
then you can use this array in the visu with the variable CurrentClientId in the array index.

2 Likes

I undestand that this is a way of doing what I need but not what I want, so I will consider that it is not possible to create local tags, although the “CurrentClientId” tag itself is a local tag. ¯_(ツ)_/¯

Thanks for the trick

You can also do this with variables defined in the interface editor of your visu page. Variables defined there only affect the client itself. If there is another client, it will have it’s own instance of these variables.

No, it doesn’t work, I declare this in the interface editor:

VAR
test : bool
END_VAR

And then assigned that test variable in the “invisible” property of a object and this test bool is switching value in every instance of connected user, not local.

You are right! I must have remembered something wrong. Sorry :wink:
Then you have to use the array …