12.4.35    SETVAL

Description:   Sets value of a tag.  Mostly commonly used to pass the value of a tag to another.  Special keywords can modify SETVAL to provide looping or other functions.

Syntax:

Tcl:              SETVAL tagname=value
SETVAL
tagname=argument

 

JScript:         SETVAL("tagname=value");
SETVAL("
tagname=argument");

 

VB Script:      SETVAL "tagname=value"
SETVAL "
tagname=argument"

 

Argument:     tagname, @tag  (analog, digital or text type tag), %REVERSE, %PLUS, %MINUS, %LOOPPLUS, %LOOPMINUS, %ROTATEPLUS, %ROTATEMINUS

Returns:        Analog, digital or text value of a Tag, local Screen Tag or DaqTag

See Also:       @, $, GETVAL, set

 

Examples:     

# Tcl

SETVAL sp1=75.3 

SETVAL sp1=@sp2

SETVAL "sp1=$variable"             

SETVAL textag1=Hello

SETVAL {texttag2=There are blanks in this string}

SETVAL {blanktag= }   

SETVAL PumpStart=%REVERSE

SETVAL {counter=%PLUS 1}

SETVAL {analogtag=%MINUS 10%}

SETVAL {motiontag=%LOOPPLUS 5}

SETVAL {position=%LOOPMINUS 5}

SETVAL {tag1=%ROTATEPLUS @speed}

SETVAL "tag2=%ROTATEPLUS $var"

SETVAL tag2=%ROTATEMINUS 5%

 

//  JScript

SETVAL("rotatefan102=%LOOPPLUS 36");

SETVAL("ZT-184=0");

 

Rem VB Script

SETVAL "rotatefan102=%LOOPPLUS 36"

SETVAL "ZT-184=0"

 

 

// tangent.js -- a JScript

var x, y, percenty, tagnvalue;

x = GETVAL("degrees") * 3.14159265 / 180;

y = Math.tan(x)

 tagnvalue = "radians=";

tagnvalue += x;

SETVAL(tagnvalue);

 

 

 

Rem tangent.vbs - a VB Script

Dim x, y, percenty

rem x = CDbl(GETVAL("degrees")) * 3.14159265 / 180  

x = GETVAL("degrees") * 3.14159265 / 180  

y = Tan(x)   ' angle is in radians

percenty = y * 100

SETVAL "radians=" & Cstr(x)

SETVAL "slope=" & Cstr(percenty)