[Imported] How to use internal variables in script?


[Imported] How to use internal variables in script?

>>Message imported from previous forum - Category:Scripts and Tips<<
User: mchartrand, originally posted: 2018-10-23 17:08:00 Id:174
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.


Say I have an internal long variable named "GenChoice", and I want to incorporate it in my script. Do I have to use a code to call it in my script? And if so, what code is it.
I want to use "GenChoice" to store a value:
GenChoice = InputBox("Enter number")
And once a number is entered, I would display the value of the variable in the mimic._**


I have done this using a Form to set a variable in the script and then set the Internal Variable to the script variable.

Server.SetOPCValue ".GenChoice.Value", ScriptVariable


Does this apply to all types of variables? I tried to use this in my code but it didn't work.
It says "the passed data type cannot be accepted for this item"._**


For variables yes it should other than a constant variable, because it is a constant.

You probably need to make it a String or an Integer to be right type.
CStr(value) CInt(Value)


What's the full use-case here?

You should keep in mind that ClearSCADA is a multi-user environment, so storing a value into the database (against an internal long) will be shared across all users, and not specific to a single user.

If you want this to be specific to a single user, and not shared across all users, then you might want to consider using the Registry script / animation methods.