12.4.14    GETVAL

Description:   Gets value of a tag.  Mostly commonly used to pass the value of a tag to script variable or to test the value of a tag in a script.

Syntax:

tcl                GETVAL tagname

                   GETVAL tagname.field

JScript          GETVAL("tagname");

                   GETVAL("tagname.field");

VB Script       GETVAL "tagname"

                   GETVAL "tagname.field"

 

Argument:     tagname and optionally .tagfield of an IO tag, Local Screen Tag or DaqTag.

Returns:        Value of the analog, digital or text tag.  

See Also:       @, SETVAL

 

Gets the value of a Tag.  A tag can be any IO tag, Constant Point, Calculation Point, Accumulation Point, DAQ Tag or screen tag (local tag).   GETVAL essentially replaces the standard input in Tcl, JScript and VB Script languages. Similar to @tag used with ACTION commands.

 

Examples:     

# Tcl - set script variable x to value of TI101

set x [GETVAL TI101]

 

# tcl - set AO101 to 1/2 of AO102

SETVAL AO101=[expr [GETVAL AO102] * 0.5]

 

# tcl - rotate fan if tag FANSTART is on

if {[GETVAL FAN_START102] != 0} then {

SETVAL {rotatefan102=%LOOPPLUS 36}

}

  

// JScript - set script variable x to value of TI101

var x

x = GETVAL("TI101");

 

// JScript - set AO101 to 1/2 of AO102

var value1

value1 = GETVAL("AO102") * 0.5;

SETVAL("AO101=" + value1);

 

// JScript - rotate fan if tag FANSTART is on

if (GETVAL("FAN_START101") == 1) {

 SETVAL("rotatefan101=%ROTATEPLUS 16");

}

 

Rem VB Script - set script variable x to value of TI101

Dim x

x = GETVAL("TI101")

 

Rem VB Script - set AO101 to 1/2 of AO102

Dim value1

value1 = GETVAL("AO102") * 0.5

SETVAL "AO101=" & value1

 

Rem VB Script - rotate fan if tag FANSTART is on

If GETVAL("FAN_START103") = 1 Then

 SETVAL "rotatefan103=%LOOPMINUS 12"

End If

 

# tcl - set script variable xsetpoint to value of TIC101:SP

set xsetpoint [GETVAL TIC101:SP]

 

# tcl - set script variable xalarm to Hi Alarm limit of TIC101:MEAS

set xalarm [GETVAL TIC101:MEAS.ALMHI]