43429members
217967posts

[Imported] How to use internal variables in script?

Highlighted
Sisko

[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.

_________________

**_jiramancio:
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._**

_______

geoffpatton:
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

____________

**_jiramancio:
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"._**

________________________

geoffpatton:
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)

_______________

bevanweiss:
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.