Server.GetOPCValue

The GetOPCValue function is a server function that allows a script to read the value from a tag in the database. A tag is a combination of the address of a database item and the name of one of its properties.

Syntax

Server.GetOPCValue (Tag)

Description

The GetOPCValue server function allows a script to read a value from a database item property (referenced by tag).

Arguments

Tag {string}

Defines the property and address of the database item that is to be read.

Returns

Value {variant}.

Returns the value for the property that is specified by the Tag. This can be integer, string, Boolean and so on.

Example:

sStateDesc = Server.GetOPCValue (".AI1.AlarmDesc")

MsgBox "The Current Alarm State of this Point is " & sStateDesc

Where:

  • sStateDesc is the name of the variable that is used to store the value that is returned by the GetOPCValue function.
  • (".AI1.AlarmDesc") tells the script the location of the value that is to be read. In this case, the AlarmDesc value of the 'AI1' point is being read. The tag is a string.
  • MsgBox instructs the script to display a Windows message box
  • "The Current Alarm State of this Point is " is the pre-defined text string that is shown in the message box
  • & sStateDesc instructs the script to add the value stored by the sStateDesc variable to the pre-defined string on the message box. The ampersand & is a VBScript operator.

Disclaimer

ClearSCADA 2017 R3